Skip to content Skip to sidebar Skip to footer

Error On Creating New Intent

what's wrong with MainActivity.this here: Intent myIntent = new Intent(MainActivity.this, SecondActivity.class); when I press Ctrl+Space it suggest MainActivity.this but then ra

Solution 1:

Try this..

If you use that intent in extends Activity your method is correct but your extends Fragment try below use getActivity()

Intent myIntent = new Intent(getActivity(), SecondActivity.class);
startActivity(myIntent);

Post a Comment for "Error On Creating New Intent"