title: Starting intent from onclicklistener
body: <p>I am trying to start a new activity from a custom onclick listener. But its unable to access MainActivity instance from onclick listener. Also, its showing wrong constructor for intent. Here is my code:</p>
  
  <pre><code>public class ChartClickListener implements OnClickListener {
      private String ChartLink;
      public ChartClickListener(String chartLink){
          this.ChartLink=chartLink;
      }
      @Override
      public void onClick(View view) {
          // TODO Auto-generated method stub
          Intent intent=new Intent(MainActivity.this,ChartImageActivity.class);
          intent.putExtra("chartLink", ChartLink);
          startActivity(intent);
      }
  }
  </code></pre>
  
  <p>Thanks for the help in advance. </p>