Reputation: 209
Friends In my activity i have placed finish()
inside onBackpressed()
, Still sometimes it is not finishing or destroying the activity.. What will be the issue?
Upvotes: 4
Views: 4821
Reputation: 15
sometimes finish() method not supported. your OnBackPressed() method should have @Override notation. bt this notation only supported in API level greater than 5.
for me it works.
Upvotes: -1
Reputation: 6128
you can also use finish(); inside onBackPressed();
please try this...
Upvotes: 0
Reputation: 527
finish() just tells the activity to do what it needs to do to finish, eg. shutdown, call on onPause, report result to parent, etc. It doesn't do an exit() call or anything.
You should return after the finish() call.
also, see this question: about finish() in android
Upvotes: 1
Reputation: 13390
super.onBackpressed()
will do the finishing
thing for you, so dont comment this line after overriding this function.. add your extra functionality in this function if you have any...
Upvotes: 5