Intro:
finish() it lets system to know that the developer wants the Activity to be finish, after finish it calls ondestroy()
ondestroy() is for final cleanup ie.
finish current activity:
To finish current activity use finish() in Intent.
finish firstactivity from secondactivity:
To finish any Activity from another Activity (ie.Firstactivity.class from SecondActivty.class)
FirstActivity.class
SecondActivity.class
Now firstactivity.class will finished from secondactivity.class.
finish() it lets system to know that the developer wants the Activity to be finish, after finish it calls ondestroy()
ondestroy() is for final cleanup ie.
- closing open connections,readers,writers
- dismiss any dialog the activity was running
- close any cursors the activity was running
finish current activity:
To finish current activity use finish() in Intent.
Intent intent = new Intent(FirstActivity.this, SecondActivity.Class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
finish firstactivity from secondactivity:
To finish any Activity from another Activity (ie.Firstactivity.class from SecondActivty.class)
FirstActivity.class
public static Activity firstIntent;
in onCreate() function firstIntent = this;
SecondActivity.class
firstIntent.finish();
Now firstactivity.class will finished from secondactivity.class.
0 comments:
Post a Comment