Issue
Basically I am looking to place some code in OnResume() which gets triggered only when a user pressses back from an activity that was called from this fragment but that code inside onResume() should not get executed on Start
Solution
You can use startActivityForResult
to start activity and onActivityResult
will be called when you come back.
If you want the behavior you mentioned in onResume
anyway, you may use a boolean flag:
boolean started = false;
@Override
public void onResume() {
super.onResume();
if(started) {
//do your task
} else {
started = true;
}
}
But onActivityResult
is the good way to do this.
Answered By - Nabin Bhandari
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.