[android-developers] Re: Checkbox are not getting selected
Probably you need this http://developer.android.com/intl/de/reference/android/widget/ListView.html#getCheckedItemIds() On 9 Жов, 06:32, pramod.deore deore.pramo...@gmail.com wrote: Now I want to add selected checkboxes to array. Normally we checked whether checkbox is selected or not as if (checkBox.isChecked()) { //do something } but now I don't have reference to checkBox, then how to check whether it is selected or not? On Oct 9, 8:05 am, pramod.deore deore.pramo...@gmail.com wrote: Hey Rocky it works. Thanks On Oct 8, 5:25 pm, Rocky rkjhaw1...@gmail.com wrote: Hey Pramod, just add this line getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); On Fri, Oct 8, 2010 at 4:39 PM, pramod.deore deore.pramo...@gmail.comwrote: Here is my .java file import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.ListView; import android.widget.Toast; public class MyList extends ListActivity { /** Called when the activity is first created. */ public void onCreate(Bundle icicle) { super.onCreate(icicle); // Create an array of Strings, that will be put to our ListActivity String[] names = new String[] { Linux, Windows7, Eclipse, Suse, Ubuntu, Solaris, Android, iPhone}; // Create an ArrayAdapter, that will actually make the Strings above // appear in the ListView this.setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_multiple_choice, names)); } �...@override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); // Get the item that was clicked Object o = this.getListAdapter().getItem(position); String keyword = o.toString(); Toast.makeText(this, You selected: + keyword, Toast.LENGTH_LONG) .show(); } } and xml file is just auto generated main.xml file. -- 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%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030274295 (R) +919886336619 -- 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: Checkbox are not getting selected
On Fri, Oct 8, 2010 at 10:32 PM, pramod.deore deore.pramo...@gmail.comwrote: but now I don't have reference to checkBox, then how to check whether it is selected or not? Look at the documentation for ListView ... - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: Checkbox are not getting selected
Anybody knows how to do this? -- 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: Checkbox are not getting selected
send details code, (xml, java), then any one can resolved ur issue. On Fri, Oct 8, 2010 at 3:55 PM, pramod.deore deore.pramo...@gmail.comwrote: Anybody knows how to do this? -- 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 -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030274295 (R) +919886336619 -- 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: Checkbox are not getting selected
Here is my .java file import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.ListView; import android.widget.Toast; public class MyList extends ListActivity { /** Called when the activity is first created. */ public void onCreate(Bundle icicle) { super.onCreate(icicle); // Create an array of Strings, that will be put to our ListActivity String[] names = new String[] { Linux, Windows7, Eclipse, Suse, Ubuntu, Solaris, Android, iPhone}; // Create an ArrayAdapter, that will actually make the Strings above // appear in the ListView this.setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_multiple_choice, names)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); // Get the item that was clicked Object o = this.getListAdapter().getItem(position); String keyword = o.toString(); Toast.makeText(this, You selected: + keyword, Toast.LENGTH_LONG) .show(); } } and xml file is just auto generated main.xml file. -- 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: Checkbox are not getting selected
Hey Pramod, just add this line getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); On Fri, Oct 8, 2010 at 4:39 PM, pramod.deore deore.pramo...@gmail.comwrote: Here is my .java file import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.ListView; import android.widget.Toast; public class MyList extends ListActivity { /** Called when the activity is first created. */ public void onCreate(Bundle icicle) { super.onCreate(icicle); // Create an array of Strings, that will be put to our ListActivity String[] names = new String[] { Linux, Windows7, Eclipse, Suse, Ubuntu, Solaris, Android, iPhone}; // Create an ArrayAdapter, that will actually make the Strings above // appear in the ListView this.setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_multiple_choice, names)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); // Get the item that was clicked Object o = this.getListAdapter().getItem(position); String keyword = o.toString(); Toast.makeText(this, You selected: + keyword, Toast.LENGTH_LONG) .show(); } } and xml file is just auto generated main.xml file. -- 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 -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030274295 (R) +919886336619 -- 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: Checkbox are not getting selected
Hey Rocky it works. Thanks On Oct 8, 5:25 pm, Rocky rkjhaw1...@gmail.com wrote: Hey Pramod, just add this line getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); On Fri, Oct 8, 2010 at 4:39 PM, pramod.deore deore.pramo...@gmail.comwrote: Here is my .java file import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.ListView; import android.widget.Toast; public class MyList extends ListActivity { /** Called when the activity is first created. */ public void onCreate(Bundle icicle) { super.onCreate(icicle); // Create an array of Strings, that will be put to our ListActivity String[] names = new String[] { Linux, Windows7, Eclipse, Suse, Ubuntu, Solaris, Android, iPhone}; // Create an ArrayAdapter, that will actually make the Strings above // appear in the ListView this.setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_multiple_choice, names)); } �...@override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); // Get the item that was clicked Object o = this.getListAdapter().getItem(position); String keyword = o.toString(); Toast.makeText(this, You selected: + keyword, Toast.LENGTH_LONG) .show(); } } and xml file is just auto generated main.xml file. -- 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 -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030274295 (R) +919886336619 -- 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: Checkbox are not getting selected
Now I want to add selected checkboxes to array. Normally we checked whether checkbox is selected or not as if (checkBox.isChecked()) { //do something } but now I don't have reference to checkBox, then how to check whether it is selected or not? On Oct 9, 8:05 am, pramod.deore deore.pramo...@gmail.com wrote: Hey Rocky it works. Thanks On Oct 8, 5:25 pm, Rocky rkjhaw1...@gmail.com wrote: Hey Pramod, just add this line getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); On Fri, Oct 8, 2010 at 4:39 PM, pramod.deore deore.pramo...@gmail.comwrote: Here is my .java file import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.ListView; import android.widget.Toast; public class MyList extends ListActivity { /** Called when the activity is first created. */ public void onCreate(Bundle icicle) { super.onCreate(icicle); // Create an array of Strings, that will be put to our ListActivity String[] names = new String[] { Linux, Windows7, Eclipse, Suse, Ubuntu, Solaris, Android, iPhone}; // Create an ArrayAdapter, that will actually make the Strings above // appear in the ListView this.setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_multiple_choice, names)); } �...@override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); // Get the item that was clicked Object o = this.getListAdapter().getItem(position); String keyword = o.toString(); Toast.makeText(this, You selected: + keyword, Toast.LENGTH_LONG) .show(); } } and xml file is just auto generated main.xml file. -- 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 -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030274295 (R) +919886336619 -- 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