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.
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 <[email protected]> wrote:
>
> On Jan 25, 11:48 pm, android beginner <[email protected]>
> 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 <[email protected]
> >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 <[email protected]>
> > > 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
> [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> > > 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en