Intent myIntent = new Intent(viewEnterChildExp.getContext(), MainActivityExpenses.class);
myIntent.putExtra("fromEnterChildExpenseToMainActivityExpenses", "true");
startActivity(myIntent);
finish();
I'm using the above code snippet in fragment
The finish()
is in red color.
When I put mouse cursor over it, an error is popped:
can resolve method finish()
TIA!
Use getActivity().finish();
from Fragment
to finish Activity in which current fragment is attached