title: What is the difference between Context and Acitivity?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4128589/difference-between-activity-context-and-application-context">Difference between Activity Context and Application Context</a>  </p>
  </blockquote>
  
  
  
  <p>When to use Context and Activity.
  I have read code that uses both Context and Activity as parameters in Constructor like below,please clear me on this</p>
  
  <pre><code>public AmazedView(Context context, Activity activity) {
          super(context);
  
          mActivity = activity;
  
          // init paint and make is look "nice" with anti-aliasing.
          mPaint = new Paint();
          mPaint.setTextSize(14);
          mPaint.setTypeface(mFont);
          mPaint.setAntiAlias(true);
  
          // setup accelerometer sensor manager.
          mSensorManager = (SensorManager)                activity.getSystemService(Context.SENSOR_SERVICE);
          // register our accelerometer so we can receive values.
          // SENSOR_DELAY_GAME is the recommended rate for games
          mSensorManager.registerListener(mSensorAccelerometer, SensorManager.SENSOR_ACCELEROMETER,
                  SensorManager.SENSOR_DELAY_GAME);
  
          // setup our maze and marble.
          mMaze = new Maze(mActivity);
          mMarble = new Marble(this);
  
          // load array from /res/values/strings.xml
          mStrings = getResources().getStringArray(R.array.gameStrings);
  
          // set the starting state of the game.
          switchGameState(GAME_INIT);
      }
  </code></pre>