tags:

views:

69

answers:

1

Hello,

I'm starting on Android and got a beginner question on switching between multiple activities.

I understand i can go between two activities by invoking an intent and then returning with setResult(). What I want to know is how to jump between multiple activities. Specifically I want to learn about the process life-cycle. I understand how every activity is started ar onCreated(), but I'm not sure how to implement onResume() or onRestart() when I want to come back.

So basically I have 3 activities: Activity1, Activity2 and Anctivity3.

I start with Activity1 and then invoke Activity2 with an Intent, and Activity2 invokes Activity3. Using buttons. Now I want to come back to Activity1 from Activity3. I do the same thing here too. Make an Intent and call startActivity(Activity1_Intent). But it gives a runtime error.

I think I need to implement OnResume() or onRestart(), but I'm not sure how to do this. In onCreate() I make a gridView, so when I come back, do I need to make that gridView again?

If anybody could give a small explanation of refer to a tutorial it would be great. Thank you very much.

A: 

Here's a good tutorial on switching between activities.

http://www.warriorpoint.com/blog/2009/05/24/android-how-to-switch-between-activities/

nickfox
Thank you nickfox. Actually that was the tutorial I followed initially. It shows how to go back and forth between activities but I like to learn about going back couple of activities.
madu