List of usage examples for android.content Intent ACTION_INSERT
String ACTION_INSERT
To view the source code for android.content Intent ACTION_INSERT.
Click Source Link
From source file:com.money.manager.ex.fragment.AllDataFragment.java
/** * start the activity of transaction management * * @param transId null set if you want to do a new transaction, or transaction id *//*from w ww . ja va 2 s . c o m*/ private void startCheckingAccountActivity(Integer transId) { // create intent, set Account ID Intent intent = new Intent(getActivity(), CheckingAccountActivity.class); // check transId not null if (transId != null) { intent.putExtra(CheckingAccountActivity.KEY_TRANS_ID, transId); intent.setAction(Intent.ACTION_EDIT); } else { intent.setAction(Intent.ACTION_INSERT); } // launch activity startActivity(intent); }
From source file:co.tinode.tindroid.ContactsFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Sends a request to the People app to display the create contact screen case R.id.menu_add_contact: final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); startActivity(intent);/* w ww. j a v a 2 s . c o m*/ break; // For platforms earlier than Android 3.0, triggers the search activity case R.id.menu_search: break; } return super.onOptionsItemSelected(item); }
From source file:com.ifeel.mt.ui.ContactsListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Sends a request to the People app to display the create contact screen if (item.getItemId() == R.id.menu_add_contact) { final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); startActivity(intent);//from w w w . j a v a 2s . com } // For platforms earlier than Android 3.0, triggers the search activity if (item.getItemId() == R.id.menu_search) { if (!Utils.hasHoneycomb()) { getActivity().onSearchRequested(); } } return super.onOptionsItemSelected(item); }
From source file:android.com.example.contactslist.ui.ContactsListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Sends a request to the People app to display the create contact screen case R.id.menu_add_contact: final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); startActivity(intent);//from www . j a v a 2 s . co m break; // For platforms earlier than Android 3.0, triggers the search activity case R.id.menu_search: if (!Utils.hasHoneycomb()) { getActivity().onSearchRequested(); } break; } return super.onOptionsItemSelected(item); }
From source file:com.albedinsky.android.support.intent.CalendarIntent.java
/** *//*from w ww . j a v a 2 s .c om*/ @NonNull @Override @SuppressWarnings("ConstantConditions") protected Intent onBuild() { switch (mType) { case TYPE_VIEW: final Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon(); builder.appendPath("time"); ContentUris.appendId(builder, mBeginTime); return new Intent(Intent.ACTION_VIEW).setData(builder.build()); case TYPE_INSERT_EVENT: return new Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI) .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, mBeginTime) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, mEndTime) .putExtra(CalendarContract.Events.TITLE, mTitle) .putExtra(CalendarContract.Events.DESCRIPTION, mDescription) .putExtra(CalendarContract.Events.EVENT_LOCATION, mLocation) .putExtra(CalendarContract.Events.AVAILABILITY, mAvailability); case TYPE_EDIT_EVENT: final Intent intent = new Intent(Intent.ACTION_EDIT); intent.setData(ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, mEventId)); if (!TextUtils.isEmpty(mTitle)) { intent.putExtra(CalendarContract.Events.TITLE, mTitle); } return intent; default: return new Intent(Intent.ACTION_VIEW) .setData(ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, mEventId)); } }
From source file:net.ddns.mlsoftlaberge.contactslist.ui.ContactsListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Sends a request to the People app to display the create contact screen case R.id.menu_add_contact: final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); startActivity(intent);/*from w w w . j av a 2s .c o m*/ break; // For platforms earlier than Android 3.0, triggers the search activity case R.id.menu_search: if (!Utils.hasHoneycomb()) { getActivity().onSearchRequested(); } break; // Sends a request to the People app to display the create contact screen case R.id.menu_starred: // switch the starred flag on/off if (starredfind == 0) { starredfind = 1; item.setIcon(R.drawable.btn_star_big_on); } else { starredfind = 0; item.setIcon(R.drawable.btn_star_big_off); } // reread the list with new flag getLoaderManager().restartLoader(ContactsQuery.QUERY_ID, null, ContactsListFragment.this); break; case R.id.menu_budget: // instantiate an activity Intent intentbudget = new Intent(getActivity(), ContactsBudgetActivity.class); // add animation options //ActivityOptions options = ActivityOptions.makeScaleUpAnimation(mContainer,0,0, // 200,400); // start the activity //startActivity(intentbudget , options.toBundle()); startActivity(intentbudget); break; } return super.onOptionsItemSelected(item); }
From source file:net.etuldan.sparss.fragment.EditFeedsListFragment.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case R.id.menu_add_feed: { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.menu_add_feed).setItems(new CharSequence[] { getString(R.string.add_custom_feed), getString(R.string.google_news_title) }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (which == 0) { startActivity(new Intent(Intent.ACTION_INSERT).setData(FeedColumns.CONTENT_URI)); } else { startActivity(new Intent(getActivity(), AddGoogleNewsActivity.class)); }//from w ww . ja va 2s . c o m } }); builder.show(); return true; } case R.id.menu_add_group: { final EditText input = new EditText(getActivity()); input.setSingleLine(true); new AlertDialog.Builder(getActivity()) // .setTitle(R.string.add_group_title) // .setView(input) // // .setMessage(R.string.add_group_sentence) // .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new Thread() { @Override public void run() { String groupName = input.getText().toString(); if (!groupName.isEmpty()) { ContentResolver cr = getActivity().getContentResolver(); ContentValues values = new ContentValues(); values.put(FeedColumns.IS_GROUP, true); values.put(FeedColumns.NAME, groupName); cr.insert(FeedColumns.GROUPS_CONTENT_URI, values); } } }.start(); } }).setNegativeButton(android.R.string.cancel, null).show(); return true; } case R.id.menu_export: case R.id.menu_import: { if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { // Should we explain? if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) { android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder( getActivity()); builder.setMessage(R.string.storage_request_explanation) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int id) { if (item.getItemId() == R.id.menu_export) { ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_EXPORT_TO_OPML); } else if (item.getItemId() == R.id.menu_import) { ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_IMPORT_FROM_OPML); } } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int id) { //Canceled Dialog } }); builder.show(); } else { if (item.getItemId() == R.id.menu_export) { ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_EXPORT_TO_OPML); } else if (item.getItemId() == R.id.menu_import) { ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_IMPORT_FROM_OPML); } } } else { if (item.getItemId() == R.id.menu_export) { exportToOpml(); } else if (item.getItemId() == R.id.menu_import) { importFromOpml(); } } return true; } } return super.onOptionsItemSelected(item); }
From source file:miguelmaciel.play.anonymouscall.ui.ContactsListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Sends a request to the People app to display the create contact screen case R.id.menu_add_contact: final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); startActivity(intent);//from w w w . ja v a 2 s. co m break; // For platforms earlier than Android 3.0, triggers the search activity case R.id.menu_search: if (!Utils.hasHoneycomb()) { getActivity().onSearchRequested(); } break; // To enter a specific phone number to make a call case R.id.menu_call_number: AlertDialog.Builder alert; alert = new AlertDialog.Builder(getActivity()); alert.setTitle("Insert Phone Number"); // Set an EditText view to get user input final EditText input = new EditText(getActivity()); input.setInputType(InputType.TYPE_CLASS_PHONE); input.setHint("Click to Insert Number"); alert.setView(input); alert.setPositiveButton("Call", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); callPhoneNumber(value); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Canceled. } }); alert.show(); break; } return super.onOptionsItemSelected(item); }
From source file:com.viktorrudometkin.burramys.fragment.EditFeedsListFragment.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case R.id.menu_add_feed: { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.menu_add_feed).setItems(new CharSequence[] { getString(R.string.add_custom_feed), getString(R.string.google_news_title) }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (which == 0) { startActivity(new Intent(Intent.ACTION_INSERT).setData(FeedColumns.CONTENT_URI)); } else { startActivity(new Intent(getActivity(), AddGoogleNewsActivity.class)); }/*from w w w . j a v a 2 s . c om*/ } }); builder.show(); return true; } case R.id.menu_add_group: { final EditText input = new EditText(getActivity()); input.setSingleLine(true); new AlertDialog.Builder(getActivity()) // .setTitle(R.string.add_group_title) // .setView(input) // // .setMessage(R.string.add_group_sentence) // .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new Thread() { @Override public void run() { String groupName = input.getText().toString(); if (!groupName.isEmpty()) { ContentResolver cr = getActivity().getContentResolver(); ContentValues values = new ContentValues(); values.put(FeedColumns.IS_GROUP, true); values.put(FeedColumns.NAME, groupName); cr.insert(FeedColumns.GROUPS_CONTENT_URI, values); } } }.start(); } }).setNegativeButton(android.R.string.cancel, null).show(); return true; } case R.id.menu_export: case R.id.menu_import: { if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.storage_request_explanation) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (item.getItemId() == R.id.menu_export) { ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_EXPORT_TO_OPML); } else if (item.getItemId() == R.id.menu_import) { ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_IMPORT_FROM_OPML); } } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); builder.show(); } else { // No explanation needed, we can request the permission. if (item.getItemId() == R.id.menu_export) { ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_EXPORT_TO_OPML); } else if (item.getItemId() == R.id.menu_import) { ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_IMPORT_FROM_OPML); } } } else { if (item.getItemId() == R.id.menu_export) { exportToOpml(); } else if (item.getItemId() == R.id.menu_import) { importFromOpml(); } } return true; } } return super.onOptionsItemSelected(item); }
From source file:br.com.mybaby.contatos.ContactsListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Sends a request to the People app to display the create contact screen case R.id.menu_add_contact: final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); startActivity(intent);// w ww . j a v a2s . com break; // For platforms earlier than Android 3.0, triggers the search activity case R.id.menu_search: if (!Util.hasHoneycomb()) { getActivity().onSearchRequested(); } break; } return super.onOptionsItemSelected(item); }