I always heard about to close any activity use finish or use android.os.Process.killProcess(android.os.Process.myPid());
first <: i think that what is exact difference between them ?
second <: what is most preferable thing of them?
third <: some time we lose pass data one activity to second when we pass data through intent, so using finish() or killprocess ,data will be lose?
first <: i think that what is exact difference between them ?
android.os.Process.killProcess(android.os.Process.myPid());
will kill all the process including all the activities on the stack that you started.
finish
will destroy the activity from which you calledfinish
second <: what is most preferable thing of them?
It depends on what you need, but it is uncommon to
killProcess
third <: some time we lose pass data one activity to second when we pass data through intent, so using finish() or killprocess ,data will be lose?
Of course killProcess! killProcess will not return to the previous activity. It will kill all the activities started in this process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With