Get the selected Item and display in Edit Text
I would like to set checkbox that allows user to select many contact names. Besides that, The selected item will be display in an Edit text.Can someone show me how?Thanks.
This is my codes for getting into the contact page:-
        
          package com.droidnova.android.samples;
          public class SelectContact extends Activity {

  private static final int PICK_CONTACT = 0;
  private EditText  contact_name;
  private Button btnPick;

  @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.button);
         
         btnPick = (Button)findViewById(R.id.button);
         btnPick.setOnClickListener(new MyOnClickListener());
          
         }

  
  @Override
   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == PICK_CONTACT) {
             if (resultCode == RESULT_OK) {
                 Cursor contact = getContentResolver().query(data.getData(), null, null, null, null);
                 contact.moveToFirst();
                 String name = contact.getString(contact.getColumnIndexOrThrow(People.NAME));
                contact_name = (EditText)findViewById(R.id.contact_name);
                contact_name.setText(name);
             
         }
     
     }
}
     
             private class MyOnClickListener implements View.OnClickListener {
      @Override
        public void onClick(View v) {
       startActivityForResult(new Intent(Intent.ACTION_PICK),PICK_CONTACT);
      }
      }
}


This codes for selecting the contacts
   public class Contacts extends ListActivity {
 private CheckBox checkBox;
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
   
        Cursor cursor = getContentResolver().query(People.CONTENT_URI, 
          new String[]{People._ID,People.NAME,People.NUMBER}, null, null, null);
        startManagingCursor(cursor);
 
        // start mappings
        String[] columns = new String[] {People.NAME, People.NUMBER};
        int[] names = new int[] {R.id.contact_name, R.id.phone_number};
 
        SimpleCursorAdapter myAdapter = new SimpleCursorAdapter(this, R.layout.contact, cursor, columns, names);
        setListAdapter(myAdapter);
        this.setListAdapter(myAdapter);
    }

This is my codes for selecting the contacts:-

        
         public class Contacts extends ListActivity {
 private CheckBox checkBox;
 
         @Override
         public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
   
        Cursor cursor = getContentResolver().query(People.CONTENT_URI, 
          new String[]{People._ID,People.NAME,People.NUMBER}, null, null, null);
        startManagingCursor(cursor);
 
        // start mappings
        String[] columns = new String[] {People.NAME, People.NUMBER};
        int[] names = new int[] {R.id.contact_name, R.id.phone_number};
 
        SimpleCursorAdapter myAdapter = new SimpleCursorAdapter(this, R.layout.contact, cursor, columns, names);
        setListAdapter(myAdapter);
        this.setListAdapter(myAdapter);
    }
        @Override
         public boolean onCreateOptionsMenu(Menu menu) {
     MenuInflater inflater = getMenuInflater();
     inflater.inflate(R.menu.firstmenu,menu);
     return true;  
          }  
        public boolean onOptionsItemSelected(MenuItem item){
   switch(item.getItemId()){
   case R.id.mark:
   return true;
   case R.id.select:
    return true;
   case R.id.back:
    final Intent i = new Intent(this,SelectContact.class);
    startActivity(i);
    return true;
   }
 return false;
   }

 
  
Get the selected Item and display in Edit Text
===

I would like to set checkbox that allows user to select many contact names. Besides that, The selected item will be display in an Edit text.Can someone show me how?Thanks.
This is my codes for getting into the contact page:-
        
          package com.droidnova.android.samples;
          public class SelectContact extends Activity {

  private static final int PICK_CONTACT = 0;
  private EditText  contact_name;
  private Button btnPick;

  @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.button);
         
         btnPick = (Button)findViewById(R.id.button);
         btnPick.setOnClickListener(new MyOnClickListener());
          
         }

  
  @Override
   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == PICK_CONTACT) {
             if (resultCode == RESULT_OK) {
                 Cursor contact = getContentResolver().query(data.getData(), null, null, null, null);
                 contact.moveToFirst();
                 String name = contact.getString(contact.getColumnIndexOrThrow(People.NAME));
                contact_name = (EditText)findViewById(R.id.contact_name);
                contact_name.setText(name);
             
         }
     
     }
}
     
             private class MyOnClickListener implements View.OnClickListener {
      @Override
        public void onClick(View v) {
       startActivityForResult(new Intent(Intent.ACTION_PICK),PICK_CONTACT);
      }
      }
}


This codes for selecting the contacts
   public class Contacts extends ListActivity {
 private CheckBox checkBox;
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
   
        Cursor cursor = getContentResolver().query(People.CONTENT_URI, 
          new String[]{People._ID,People.NAME,People.NUMBER}, null, null, null);
        startManagingCursor(cursor);
 
        // start mappings
        String[] columns = new String[] {People.NAME, People.NUMBER};
        int[] names = new int[] {R.id.contact_name, R.id.phone_number};
 
        SimpleCursorAdapter myAdapter = new SimpleCursorAdapter(this, R.layout.contact, cursor, columns, names);
        setListAdapter(myAdapter);
        this.setListAdapter(myAdapter);
    }

This is my codes for selecting the contacts:-

        
         public class Contacts extends ListActivity {
 private CheckBox checkBox;
 
         @Override
         public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
   
        Cursor cursor = getContentResolver().query(People.CONTENT_URI, 
          new String[]{People._ID,People.NAME,People.NUMBER}, null, null, null);
        startManagingCursor(cursor);
 
        // start mappings
        String[] columns = new String[] {People.NAME, People.NUMBER};
        int[] names = new int[] {R.id.contact_name, R.id.phone_number};
 
        SimpleCursorAdapter myAdapter = new SimpleCursorAdapter(this, R.layout.contact, cursor, columns, names);
        setListAdapter(myAdapter);
        this.setListAdapter(myAdapter);
    }
        @Override
         public boolean onCreateOptionsMenu(Menu menu) {
     MenuInflater inflater = getMenuInflater();
     inflater.inflate(R.menu.firstmenu,menu);
     return true;  
          }  
        public boolean onOptionsItemSelected(MenuItem item){
   switch(item.getItemId()){
   case R.id.mark:
   return true;
   case R.id.select:
    return true;
   case R.id.back:
    final Intent i = new Intent(this,SelectContact.class);
    startActivity(i);
    return true;
   }
 return false;
   }

 
  