Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the compat method to use finishAffinity() for API 14?

Tags:

android

Since finishAffinity() was only introduced in API 16, but my app targets 14+. How do I get this to work for 14+?

Thank you!

like image 501
nubela Avatar asked May 09 '14 16:05

nubela


People also ask

What is finishAffinity ()?

finishAffinity() : finishAffinity() is not used to "shutdown an application". It is used to remove a number of Activities belonging to a specific application from the current task (which may contain Activities belonging to multiple applications).

How do you close all activities?

Delete all activity On your Android phone or tablet, go to myactivity.google.com. Above your activity, tap Delete .

How do you get a response from an activity in Android?

You must call the second activity using the startActivityForResult method. In your second activity, when it is finished, you can execute the setResult method where basically you put the result information. Then, on your first activity, you override the onActivityResult method.

How do you close a whole app on Android?

Use this line of code: System. exit(1);


1 Answers

Got it.

Use ActivityCompat.finishAffinity(this); (with v4 support library)

like image 144
nubela Avatar answered Sep 24 '22 15:09

nubela