On Jan 27, 7:03 pm, android beginner <android.beginne...@gmail.com>
wrote:
> Hi,
> The basic list that I want to view is working.
>
> In my first list activity(ListDemoActivity), I choosed some element, which
> triggers another list A activity. If I go back (on pressing "BACK" key), the
> state of ListDemoActivity screen is preserved. Now If I select the same
> element again, I expect the state of A activity to be preserved aswell, but
> its not happening.

You're assuming things that are not true.  Its an activity stack, so
once you pop it off (hit the back key) that state is lost, and you
will be creating a new activity when launching that activity A again.

I'd recommend learning a little bit about the nature of android before
getting too deep into developing code.
The Androidology videos will get you started and the Google I/O videos
are some of my favorites for getting into Android as a pro.
http://developer.android.com/intl/de/videos/index.html#v=opZ69P-0Jbc


> Below is the code snippet, Can you please suggest me what I need to do?
>
> public class ListDemoActivity extends ListActivity {
>     String[] firstPage = {"a", "b", "c", "d", "e"};
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         setListAdapter(new ArrayAdapter<String>(this,
>                         android.R.layout.simple_list_item_1,
>                         firstPage));
>
>     }
>
>     public void onListItemClick(ListView parent, View v,
>                                 int position, long id)
>     {
>         String txt = firstPage[position];
>         if ((txt == "a") ||
>             (txt == "b"))
>         {
>             Intent startActivity = new Intent(this, Activity_A.class);
>             startActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>
>             startActivity(startActivity);
>         }
>         else
>         {
>             Intent startActivity = new Intent(this, Activity_B.class);
>             startActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>
>             startActivity(startActivity);
>         }
>
>     }
>
> }
> On Tue, Jan 26, 2010 at 5:28 PM, theSmith <chris.smith...@gmail.com> wrote:
>
> > On Jan 25, 11:48 pm, android beginner <android.beginne...@gmail.com>
> > wrote:
> > > so, each sub-lists should be created as list activity. On selecting any
> > > item, should call that particular list activity. Is my understanding
> > > correct?
>
> > Yes
>
> > > Also, how to store parent list in the stack? so that on pressing "escape"
> > > key, I can navigate backwards.
>
> > Android does this automatically, and I assume you mean the 'back'
> > key.  Each new activity is launched ontop of the older ones allowing
> > you to navigate backwards down the stack.
>
> > -theSmith
>
> > > Thanks
>
> > > On Tue, Jan 26, 2010 at 9:11 AM, saad bouchehboun <bsaad1...@gmail.com
> > >wrote:
>
> > > > your item must be a listactivity , when you add it to your parent
> > > > list , the UI is adapted automaticly .
>
> > > > On 25 jan, 06:24, android beginner <android.beginne...@gmail.com>
> > > > wrote:
> > > > >  Hi,
>
> > > > > My Activity has list of items and on clicking any item, new window
> > with
> > > > > different set of list has to appear and this can continue upto 4 or 5
> > > > level
> > > > > depths. I need your expert advice on how to achieve this.
>
> > > > > Can I have each sub-list to be of separate activity? If there are any
> > > > online
> > > > > examples matching this requirement, please let me know.
>
> > > > > Thank
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> > <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to