3

I'm fairly new to Android and I'm a little bit confused on when to start new activities. Here is the situation. I have a library, webview and reader activity.

Say the user wants to go library -> webview -> reader -> library

Should I be creating a new library activity after the reader activity or should I be trying to show the original library activity? If I do the latter will it mess up my activity stack?

odiggity
  • 4,117
  • 7
  • 34
  • 41
  • What does the Webview ACtivity? I have the impression that coming back from the Reader to the Library would be better than creating a new library... but more info would be helpful. – Shlublu Jul 27 '11 at 19:17

1 Answers1

3

It seems to me you are confusing the ideas of "creating" a new activity and switching activities... You dont really "create" new activities dynamically, you call them from other activities via Intent's. So if you need to go to your library activity after your reader, just start an intent to change activities. your app only can only have one active activity at a time.

Adam Storm
  • 724
  • 1
  • 6
  • 13
  • Perfect, I didn't realize that the app can only have one active activity. I thought every time I used startActivity it was creating a new 'instance' of the activity. – odiggity Jul 27 '11 at 19:19
  • well, it sort of puts your old activities on a backstack. but thats a seperate issue. I think the underlying answer to your question can be solved with this diagram: *there is nothing wrong with a program that has the following activity flow* Activity1 -> Activity2 -> Activity3 -> Activity1 -> Activity2 -> Activity3 -> Activity1.. etc. If you feel like this satisfied your question, be sure to accept this as your answer! = ) – Adam Storm Jul 27 '11 at 19:23
  • yes it did, had to wait for a while before it would let me accept it. thanks! – odiggity Jul 27 '11 at 19:37