Here is the problem. I have an application in which I want to press a button, start a new action that displays a list of elements, allows the user to select any number of elements, click "Submit" and send this data to the original activity that triggered the new action using the list of elements. Here's the basic structure:
Activity A -> Activity B (select items, press submit) -> [already running] Activity A (receive sent items)
I have no problem sending data back and forth. The problem that occurs to me is that when I try to restart Activity A, it goes through the Activity onCreate() method. I prefer not to do this because I want to be able to pre-set everything in the onCreate() method, and then add what already exists using the onRestart() method. I'm not quite sure why the onCreate() method is called every time I restart the action. I suppose I call activity in Activity B:
Intent intent = new Intent(this, PatientChartActivity.class); intent.putExtra("checked", checked); intent.putStringArrayListExtra("checked", checked); startActivity(intent);
I look at the life cycle of Android activity, and I'm not sure why it doesnβt automatically go back to the previous action, unless I really need to get it to do it. The only thing I'm sure is that the work that works is not destroyed. I put the Log.v(TAG, "DESTROY") log onDestroy() in the onDestroy() method, ensuring that it does not destroy the action. I tried to use different flags when I start the activity to tell the system that I want to restore the previously launched activity, but they do not seem to work either. I can get them wrong. I researched exstensiveley on this topic, but none of the solutions I found helped. Here , this is a problem that, it seems to me, is identical to mine, but does not seem to have decided what I was looking for. I also looked at the following links for other possible solutions, but didn't work.
http://www.droidnova.com/use-intents-to-start-other-activities,76.html
http://www.warriorpoint.com/blog/2009/05/24/android-how-to-switch-between-activities/