Intent intent=new Intent(Intent.ACTION_EDIT,Uri.parse("content://com.android.contacts/contacts/"+id));
startActivity(intent);
Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
startActivity(intent);
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- Button button = (Button)findViewById(R.id.email);
- button.setOnClickListener(new OnClickListener(){
- public void onClick(View v) {
- onClickSender();
- }});
- }
- private void onClickSender()
- {
- try
- {
- Uri contactUri = Uri.fromParts("mailto", "liaojianguo19840726@gmail.com", null);
- Intent contactIntent = new Intent(Contacts.Intents.SHOW_OR_CREATE_CONTACT);
- contactIntent.setData(contactUri);
- // Pass along full E-mail string for possible create dialog
- contactIntent.putExtra(Contacts.Intents.EXTRA_CREATE_DESCRIPTION,
- "liaojianguo19840726@gmail.com");
- // Only provide personal name hint if we have one
- String senderPersonal = null;
- if (senderPersonal != null)
- {
- contactIntent.putExtra(Intents.Insert.NAME, senderPersonal);
- }
- startActivity(contactIntent);
- }
- catch (Exception me)
- {
- if (Config.LOGV)
- {
- }
- }
- }
- }