Tuesday, January 8, 2013

[android-developers] how to get data from choice_mode_multiple

i am new to android...... i was able to read the contacts in listview with checkboxes. I want to get the selected contacts data and have to send a message(sms) to selected contacts

but don't know how to proceed further

can anyone help me with that

thanks in advance

here is my code to read contacts

  public class MainActivity extends Activity {    public ArrayList<Boolean> itemChecked = null;  ArrayAdapter<String> myAdapterInstance;  SimpleCursorAdapter adapter;  String[] projection = new String[] { Phone._ID, Phone.DISPLAY_NAME,          Phone.NUMBER };  private static final Uri CONTACTS_URI = ContactsContract.Contacts.CONTENT_URI;  @Override  public void onCreate(Bundle savedInstanceState) {      super.onCreate(savedInstanceState);      setContentView(R.layout.main);      ADD = (Button) findViewById(R.id.button1);      cancel = (Button) findViewById(R.id.button1);      final Cursor cursor = managedQuery(Phone.CONTENT_URI, projection, null,              null, Phone.DISPLAY_NAME + " ASC");      final ListView lv = (ListView) findViewById(R.id.listView2);      adapter = new SimpleCursorAdapter(this,               R.layout.contactslist,              cursor,              new String[] { "display_name", Phone.NUMBER, "_id" },                                                               new int[] { R.id.textView11, R.id.textView12, R.id.checkBox1 }         );        lv.setAdapter(adapter);      lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);    }    @Override  protected void onDestroy() {      super.onDestroy();
  
  how do i get the selected contacts to some cursor or adapter..........?
  

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment