Issue
I have an Activity and i want to close it without calling onDestroy(). So I use onStop(); which looks like
@Override
public void onStop(){
super.onStop();
try{
unbindService(mServerConn);
}
catch(Exception e){
e.printStackTrace();
}
}
I runs the code but the activity is still visible on the screen
Can you help me to hide it? Thanks!
Solution
Usage of onStop() is not correct in that situation. If you need to close activity use finish().
Intent openStartingPoint = new Intent(this, MainActivity.class);
openStartingPoint.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(openStartingPoint);
finish();
This should work fine.
Answered By - hornet2319
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.