-1

This is the part of my code where I am getting the error.

    @Override
    public void onClick(View v)
    {
                  Intent i = new Intent(MySampleFragment.this,Alert.class);
                  startActivity(i);
    }
Sharad Nanda
  • 406
  • 1
  • 15
  • 27

1 Answers1

1

Use getActivity() or v.getContext() instead of MySampleFragment.this as first parameter of Intent constructor as:

Intent i = new Intent(getActivity(),Alert.class);
//Intent i = new Intent(v.getContext(),Alert.class);
startActivity(i);
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213