android.provider.ContactsContract.Intents Java Examples

The following examples show how to use android.provider.ContactsContract.Intents. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContactDetailsActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
    intent.setType(Contacts.CONTENT_ITEM_TYPE);
    intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid().toEscapedString());
    intent.putExtra(Intents.Insert.IM_PROTOCOL, CommonDataKinds.Im.PROTOCOL_JABBER);
    intent.putExtra("finishActivityOnSaveCompleted", true);
    try {
        ContactDetailsActivity.this.startActivityForResult(intent, 0);
    } catch (ActivityNotFoundException e) {
        ToastCompat.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show();
    }
}
 
Example #2
Source File: MainActivity.java    From Contacts with MIT License 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
	if (item.getItemId() == R.id.action_add_contact)
	{
		// Creates a new Intent to insert a contact
		Intent intent = new Intent(Intents.Insert.ACTION);
		// Sets the MIME type to match the Contacts Provider
		intent.setType(ContactsContract.RawContacts.CONTENT_TYPE);
		intent.putExtra("finishActivityOnSaveCompleted", true);
		startActivity(intent);
		return true;
	}

	if (item.getItemId() == R.id.action_help_me)
	{
		startActivity(new Intent(this, HelpMeActivity.class));
		return true;
	}

	if (item.getItemId() == R.id.action_settings)
	{
		mCurrentFragmentIndex = mViewPager.getCurrentItem();
		startActivityForResult(new Intent(this, PreferencesActivity.class), SETTINGS_CODE);
		return true;
	}

	return super.onOptionsItemSelected(item);
}
 
Example #3
Source File: ContactDetailsActivity.java    From Conversations with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
    intent.setType(Contacts.CONTENT_ITEM_TYPE);
    intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid().toEscapedString());
    intent.putExtra(Intents.Insert.IM_PROTOCOL, CommonDataKinds.Im.PROTOCOL_JABBER);
    intent.putExtra("finishActivityOnSaveCompleted", true);
    try {
        ContactDetailsActivity.this.startActivityForResult(intent, 0);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show();
    }
}