I am new to Android development, and I need help in maintaining an activity state. What is the correct way to save an instance from onPause and restore it from onRestore, since, obviously, Android does not send the savedInstanceState packet, as it does with onCreate or onSaveInstanceState, for example. Or is there a better way to save besides using the savedInstanceState package?
It makes sense?
[edit] Well, I think I know what my real problem is ... But first, I think I was looking for using SharedPreferences instead of savedInstanceState.
So, making more debugging logs of browsing, I notice that instead of bringing activity at the top of the stack, it creates a new one. Yes, I understand that I am creating a new one.
Intent itemintent = new Intent(MediaList.this, AudioPlayer.class); Bundle b = new Bundle(); //...putString some strings to send itemintent.putExtra("android.intent.extra.INTENT", b); itemintent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivityForResult(itemintent,0);
... But shouldn't FLAG_ACTIVITY_REORDER_TO_FRONT prevent the creation of a new action? I assume that he thinks he should create a new one, so how do I send multiple lines?
Even better, how can I check if this activity is already on the stack and switch to it if the lines are the same? - I start this operation when the user clicks a multimedia item from the list. [/ Edit]
source share