Re: [android-developers] Re: list - need suggestion
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 ArrayAdapterString(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.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-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.comandroid-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
Re: [android-developers] Re: list - need suggestion
first off, use String.equals() to compare the contents of strings, not ==. the == operator checks for object reference equality. this isn't what you want, unless you use intern() throughout, which i wouldn't recommend. 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 ArrayAdapterString(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 mailto:chris.smith...@gmail.comchris.smith...@gmail.com wrote: On Jan 25, 11:48 pm, android beginner mailto:android.beginne...@gmail.comandroid.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 mailto:bsaad1...@gmail.combsaad1...@gmail.comwrote: 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 mailto:android.beginne...@gmail.comandroid.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 mailto:android-developers@googlegroups.comandroid-developers@googlegroups.com To unsubscribe from this group, send email to mailto:android-developers%2bunsubscr...@googlegroups.comandroid-developers+unsubscr...@googlegroups.commailto:android-developers%252bunsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=enhttp://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 mailto:android-developers@googlegroups.comandroid-developers@googlegroups.com To unsubscribe from this group, send email to mailto:android-developers%2bunsubscr...@googlegroups.comandroid-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=enhttp://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=enhttp://groups.google.com/group/android-developers?hl=en -- jason.vp.engineering.particle -- You received this message because you are subscribed to the Google Groups Android Developers group. To
[android-developers] Re: list - need suggestion
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 ArrayAdapterString(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.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-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.comandroid-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
Re: [android-developers] Re: list - need suggestion
Yea, went through the document and got good understanding of activities tasks. I observed one issue though (Not sure if its an issue, maybe I need to call some other functions). In my first list A, I selected one item using Keys. This leads to create another list Activity B. I just browsed the list using Key, so that one element will be highlighted (focussed). These activities are created with Launch mode singleTop Then I went to the Home Screen. Now on selecting my Activity Icon again, I got the list Activity B screen but its not highlighted. Using onPause, I got the position and in onResume I called setSelection(position). But still that element in the list is not highlighted Any Suggestions? Thanks On Thu, Jan 28, 2010 at 11:52 AM, theSmith chris.smith...@gmail.com wrote: 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 ArrayAdapterString(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.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
Re: [android-developers] Re: list - need suggestion
Yes. Because of touch mode, I didn't get the focus. Since my hardware doesnt have the the touch screen, it should not be an issue :) On Thu, Jan 28, 2010 at 3:23 PM, android beginner android.beginne...@gmail.com wrote: Yea, went through the document and got good understanding of activities tasks. I observed one issue though (Not sure if its an issue, maybe I need to call some other functions). In my first list A, I selected one item using Keys. This leads to create another list Activity B. I just browsed the list using Key, so that one element will be highlighted (focussed). These activities are created with Launch mode singleTop Then I went to the Home Screen. Now on selecting my Activity Icon again, I got the list Activity B screen but its not highlighted. Using onPause, I got the position and in onResume I called setSelection(position). But still that element in the list is not highlighted Any Suggestions? Thanks On Thu, Jan 28, 2010 at 11:52 AM, theSmith chris.smith...@gmail.comwrote: 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 ArrayAdapterString(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.comandroid-developers%2bunsubscr...@googlegroups.com
Re: [android-developers] Re: list - need suggestion
so, each sub-lists should be created as list activity. On selecting any item, should call that particular list activity. Is my understanding correct? Also, how to store parent list in the stack? so that on pressing escape key, I can navigate backwards. Thanks On Tue, Jan 26, 2010 at 9:11 AM, saad bouchehboun bsaad1...@gmail.comwrote: 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.comandroid-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
[android-developers] Re: list - need suggestion
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.comwrote: 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.comandroid-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