Example usage for android.content Intent ACTION_INSERT

List of usage examples for android.content Intent ACTION_INSERT

Introduction

In this page you can find the example usage for android.content Intent ACTION_INSERT.

Prototype

String ACTION_INSERT

To view the source code for android.content Intent ACTION_INSERT.

Click Source Link

Document

Activity Action: Insert an empty item into the given container.

Usage

From source file:Main.java

/**
 * @brief      Get the add tel intent//from  w  w  w . j  a va 2 s.c  o  m
 *
 * @par        Sync (or) Async:
 * This is a Synchronous function.
 *
 * @param [IN] telNumber    Tel number.\n
 * 
 * @return     
 *
 * @author     daiping.zhao
 * @since      1.0.0.0
 * @version    1.0.0.0
 * @par        Prospective Clients:
 * External Classes
 */
public static Intent doAddTelContact(String telNumber) {
    Intent newIntent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
    newIntent.putExtra(Intents.Insert.PHONE, telNumber);
    return newIntent;
}

From source file:Main.java

/**
 * @brief      Get the intent to insert email into contact
 *
 * @par        Sync (or) Async:/*ww  w . j  av a  2s . co m*/
 * This is a Synchronous function.
 *
 * @param [IN] email    Email address.\n
 * 
 * @return     
 *
 * @author     daiping.zhao
 * @since      1.0.0.0
 * @version    1.0.0.0
 * @par        Prospective Clients:
 * External Classes
 */
public static Intent doAddEmailToContact(String email) {
    Intent newIntent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
    newIntent.putExtra(Intents.Insert.EMAIL, email);
    return newIntent;
}

From source file:Main.java

/**
 * Builds an Intent to add a new event to the calendar.
 *
 * @param title The title of the event.//from www  . jav  a 2  s.c o  m
 * @param start The start date and time.
 * @param end   The end date and time.
 * @param where Where the event is held (e.g.: an address).
 */
public static Intent getAddEventIntent(final String title, final Date start, final Date end,
        final String where) {
    Intent intent = new Intent(Intent.ACTION_INSERT);
    intent.setData(CalendarContract.Events.CONTENT_URI);
    intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, start.getTime());
    intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end.getTime());
    intent.putExtra(CalendarContract.Events.TITLE, title);

    if (where != null) {
        intent.putExtra(CalendarContract.Events.EVENT_LOCATION, where);
    }

    return intent;
}

From source file:org.linphone.compatibility.ApiFivePlus.java

public static Intent prepareAddContactIntent(String displayName, String sipUri) {
    Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
    intent.putExtra(ContactsContract.Intents.Insert.NAME, displayName);

    // VoIP field not available, we store the address in the IM field
    intent.putExtra(ContactsContract.Intents.Insert.IM_HANDLE, sipUri);
    intent.putExtra(ContactsContract.Intents.Insert.IM_PROTOCOL, "sip");

    return intent;
}

From source file:com.microsoft.office365.starter.Email.MailItemDetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mailitem_detail);

    // Show the Up button in the action bar.
    getActionBar().setDisplayHomeAsUpEnabled(true);

    // savedInstanceState is non-null when there is fragment state
    // saved from previous configurations of this activity
    // (e.g. when rotating the screen from portrait to landscape).
    // In this case, the fragment will automatically be re-added
    // to its container so we don't need to manually add it.
    // For more information, see the Fragments API guide at:
    ////from  w ww .  ja  v a 2 s .c o m
    // http://developer.android.com/guide/components/fragments.html
    //

    if (savedInstanceState == null) {
        // see if we are creating new email, or viewing existing.
        // determines which fragment we need to load.
        Intent intent = getIntent();
        String actionMode = intent.getAction();
        if (Intent.ACTION_INSERT == actionMode) {
            // display the compose fragment to compose a new email
            MailItemComposeFragment fragment = new MailItemComposeFragment();
            getFragmentManager().beginTransaction().add(R.id.mailitem_detail_container, fragment).commit();

        } else {
            // display the detail view fragment to read an email

            // Create the detail fragment and add it to the activity
            // using a fragment transaction.
            Bundle arguments = new Bundle();
            arguments.putString(MailItemDetailFragment.ARG_ITEM_ID,
                    getIntent().getStringExtra(MailItemDetailFragment.ARG_ITEM_ID));
            MailItemDetailFragment fragment = new MailItemDetailFragment();
            fragment.setArguments(arguments);
            getFragmentManager().beginTransaction().add(R.id.mailitem_detail_container, fragment).commit();

        }

    }
}

From source file:com.appunite.helpers.EditFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getActivity().getIntent();
    String action = intent.getAction();

    mDiscard = false;//w  w w .j a  v a2 s. co  m

    if (savedInstanceState != null) {
        mUri = savedInstanceState.getParcelable(STATE_URI);
        checkState(mUri != null);
        mIsEdit = savedInstanceState.getBoolean(STATE_IS_EDIT);
    } else if (Intent.ACTION_INSERT.equals(action) || Intent.ACTION_INSERT_OR_EDIT.equals(action)) {
        mUri = intent.getData();
        if (mUri == null) {
            mUri = getInsertionUri();
        }
        checkArgument(mUri != null);
        mIsEdit = false;
    } else if (Intent.ACTION_EDIT.equals(action)) {
        mUri = intent.getData();
        checkArgument(mUri != null);
        mIsEdit = true;
    } else {
        throw new IllegalArgumentException("Unknown action: " + action);
    }
}

From source file:org.inftel.ssa.mobile.ui.fragments.ProjectEditFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mActivity = getActivity();/*from  ww  w . j  a v  a 2 s  . co m*/
    mIntent = mActivity.getIntent();
    mAction = mIntent.getAction();

    if (Intent.ACTION_EDIT.equals(mAction)) {
        mState = STATE_EDIT;
        getLoaderManager().initLoader(0, null, this);
    } else if (Intent.ACTION_INSERT.equals(mAction)) {
        mState = STATE_INSERT;
        // New item (set default values)
    }

    setHasOptionsMenu(true);
}

From source file:org.klnusbaum.udj.network.PlayerCommService.java

@Override
public void onHandleIntent(Intent intent) {
    Log.d(TAG, "In Player Comm Service");
    AccountManager am = AccountManager.get(this);
    final Account account = (Account) intent.getParcelableExtra(Constants.ACCOUNT_EXTRA);
    if (intent.getAction().equals(Intent.ACTION_INSERT)) {
        joinPlayer(intent, am, account, true);
    } else {// w  w  w.j a  va 2  s. c om
        Log.d(TAG, "Unrecognized action of, it was " + intent.getAction());
    }
}

From source file:org.klnusbaum.udj.network.EventCommService.java

@Override
public void onHandleIntent(Intent intent) {
    Log.d(TAG, "In Event Comm Service");
    AccountManager am = AccountManager.get(this);
    final Account account = (Account) intent.getParcelableExtra(Constants.ACCOUNT_EXTRA);
    if (intent.getAction().equals(Intent.ACTION_INSERT)) {
        enterEvent(intent, am, account, true);
    } else if (intent.getAction().equals(Intent.ACTION_DELETE)) {
        //TODO handle if userId is null shouldn't ever be, but hey...
        leaveEvent(am, account, true);//from  ww w . j a va  2  s.co m
    } else {
        Log.d(TAG, "ACTION wasn't delete or insert, it was " + intent.getAction());
    }
}

From source file:com.battlelancer.seriesguide.util.ShareUtils.java

/**
 * Launches a calendar insert intent for the given episode.
 *//*from  w w w  . jav  a  2s . c o m*/
public static void suggestCalendarEvent(Context context, String showTitle, String episodeTitle,
        long episodeReleaseTime, int showRunTime) {
    Intent intent = new Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI)
            .putExtra(CalendarContract.Events.TITLE, showTitle)
            .putExtra(CalendarContract.Events.DESCRIPTION, episodeTitle);

    long beginTime = TimeTools.getEpisodeReleaseTime(context, episodeReleaseTime).getTime();
    long endTime = beginTime + showRunTime * DateUtils.MINUTE_IN_MILLIS;
    intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime);
    intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime);

    if (!Utils.tryStartActivity(context, intent, false)) {
        Toast.makeText(context, context.getString(R.string.addtocalendar_failed), Toast.LENGTH_SHORT).show();
        Utils.trackCustomEvent(context, TAG, "Calendar", "Failed");
    }
}