I have a gridview and I'm setting a button adapter to it. It has 2 buttons and I want to set the Onclick listeners for these buttons. 

```
 GridView gridview = (GridView) findViewById(R.id.gridView_table_select);
 gridview.setAdapter(new ButtonAdapter(this));

```

In the getView() method for my Gridview, I'm adding buttons as grid items. I'm also setting the onClick listener for the buttons.

```
 public View getView(int position,
                           final View convertView, ViewGroup parent) {
  Button btn;

  if (convertView == null) {
   // if it's not recycled, initialize some attributes
   btn = new Button(mContext);
   btn.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Context context = v.getContext();
            Intent intent = new Intent(context , Main.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        }
    });
   btn.setLayoutParams(new GridView.LayoutParams(350, 65));
   btn.setPadding(8, 8, 8, 8);
   btn.setWidth(LayoutParams.WRAP_CONTENT);

```

As you can see I'm setting the onClick for the buttons, and trying to start a new activity, but when I click on these buttons, nothing happens.
What should I correct?