difference between finish() and killProcess by myPid();
original source: https://stackoverflow.com/questions/7283324/difference-between-finish-and-killprocess-by-mypid
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 called finish
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.