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);
}
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);
}
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);