List of usage examples for android.content Intent ACTION_SENDTO
String ACTION_SENDTO
To view the source code for android.content Intent ACTION_SENDTO.
Click Source Link
From source file:by.android.dailystatus.SettingsActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.lay_rate: RateThisApp.showRateDialog(this); break;/*from w w w . j av a 2 s . c o m*/ case R.id.lay_facebook: // start Facebook Login Session.openActiveSession(this, true, new Session.StatusCallback() { // callback when session changes state @Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { // try { // Bundle params = new Bundle(); // params.putString("name", // "Facebook SDK for Android");// title // params.putString("caption", // "Build great social apps and get more installs.");// // params.putString( // "description", // "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps."); // // WebDialog feedDialog = (new // WebDialog.FeedDialogBuilder( // SettingsActivity.this, Session // .getActiveSession(), params)) // .setOnCompleteListener(null).build(); // feedDialog.show(); // } catch (Exception e) { // e.printStackTrace(); // } if (!faceLogin) { Request.newMeRequest(session, new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { if (user != null) { faceUserName.setText(user.getFirstName() + " " + user.getLastName()); facebookDescription.setText("? "); } } }).executeAsync(); } else { session.closeAndClearTokenInformation(); faceUserName.setText(getResources().getString(R.string.facebook)); facebookDescription.setText("? "); } } } }); break; case R.id.lay_connect_with_developer: // String recepientEmail = "sekt88@gmail.com"; // either set to String recepientEmail = "alex-pers92@mail.ru"; // destination Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:" + recepientEmail)); try { startActivity(Intent.createChooser(intent, "Send Email")); } catch (Exception e) { e.printStackTrace(); } break; case R.id.lay_version: PackageInfo pInfo; String vers = ""; try { pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); vers = "Version " + pInfo.versionName + ", first application release"; } catch (NameNotFoundException e) { e.printStackTrace(); } VersionDialog dialog = new VersionDialog(); dialog.setText(vers); dialog.show(getSupportFragmentManager(), "versionDialog"); break; case R.id.lay_license: LicenseDialog licenseDialog = new LicenseDialog(); licenseDialog.setText("Nothin' to see here"); licenseDialog.show(getSupportFragmentManager(), "licenseDialog"); break; default: break; } }
From source file:com.denel.facepatrol.MainActivity.java
public void onGroupEmail(String[] email_grp) { // enter code here Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(Intent.EXTRA_EMAIL, email_grp); //emailIntent.setType("message/rfc822"); emailIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(Intent.createChooser(emailIntent, "Send Group Email...")); }
From source file:com.achep.base.ui.fragments.dialogs.FeedbackDialog.java
private void send(@NonNull CharSequence title, @NonNull CharSequence body, boolean attachLog) { Activity context = getActivity();// w w w . j ava 2 s. c o m String[] recipients = { Build.SUPPORT_EMAIL }; Intent intent = new Intent().putExtra(Intent.EXTRA_EMAIL, recipients).putExtra(Intent.EXTRA_SUBJECT, title) .putExtra(Intent.EXTRA_TEXT, body); if (attachLog) { attachLog(intent); intent.setAction(Intent.ACTION_SEND); intent.setType("message/rfc822"); } else { intent.setAction(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle it } if (IntentUtils.hasActivityForThat(context, intent)) { startActivity(intent); dismiss(); } else { ToastUtils.showLong(context, R.string.feedback_error_no_app); } }
From source file:com.jozapps.MetricConverter.MainActivity.java
public void requestNewUnitEmailIntent() { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:support@jozapps.com")); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "I would like this unit to be " + "included: " + "\n\n\n\n" + "Version: " + getResources().getString(R.string.VersionNumber)); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "[Converter] New unit request"); // Search for email clients to display try {//from www .j av a 2 s. c o m startActivityForResult(Intent.createChooser(emailIntent, "Send your email in:"), 0); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(MainActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } }
From source file:fr.tvbarthel.attempt.googlyzooapp.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_license) { (new LicenseDialogFragment()).show(getFragmentManager(), "dialog_license"); return true; } else if (id == R.id.action_more_projects) { (new MoreProjectDialogFragment()).show(getFragmentManager(), "dialog_more_projects"); return true; } else if (id == R.id.action_about) { (new AboutDialogFragment()).show(getFragmentManager(), "dialog_about"); return true; } else if (id == R.id.action_support) { startActivity(new Intent(this, SupportActivity.class)); return true; } else if (id == R.id.action_contact_us) { String contactUriString = getString(R.string.contact_send_to_uri, Uri.encode(getString(R.string.contact_mail)), Uri.encode(getString(R.string.contact_default_subject))); Uri contactUri = Uri.parse(contactUriString); Intent sendMail = new Intent(Intent.ACTION_SENDTO); sendMail.setData(contactUri);//from ww w.j a v a 2 s . c om startActivity(sendMail); return true; } else if (id == R.id.action_camera) { if (mRoundedOverlay.getVisibility() != View.VISIBLE) { mRoundedOverlay.open(); } else { hideAdditionalContent(); } return true; } return super.onOptionsItemSelected(item); }
From source file:com.tinfoil.sms.sms.SendMessageActivity.java
private void handleSendIntent() { Intent intent = this.getIntent(); //Toast.makeText(this, ""+(Intent.ACTION_SENDTO.equals(intent.getAction())&& intent.getType() != null), Toast.LENGTH_LONG).show(); if (Intent.ACTION_SEND.equals(intent.getAction()) && intent.getType() != null) { if ("text/plain".equals(intent.getType())) { String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); if (sharedText != null) { setupComposeView(null, sharedText); }//w w w . j a v a 2 s . co m } } else if (Intent.ACTION_SENDTO.equals(intent.getAction())) { String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); Uri uri = this.getIntent().getData(); if (uri.getSchemeSpecificPart() != null) { String number = uri.getSchemeSpecificPart(); if (dba.inDatabase(number)) { setupMessageView(SMSUtility.format(number), sharedText); } else { setupComposeView(SMSUtility.format(number), sharedText); } } } }
From source file:uno.weichen.abnd10_inventoryapp.DetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); // Find all relevant views that we will need to read user input from mNameEditText = (EditText) findViewById(R.id.edit_product_name); mPriceEditText = (EditText) findViewById(R.id.edit_product_price); mQuantityTextView = (TextView) findViewById(R.id.textview_product_quantity); mContactEditText = (EditText) findViewById(R.id.edit_product_contact); mSoldQuantityTextView = (TextView) findViewById(R.id.textview_product_sold_quantity); mRestockQuantityTextView = (TextView) findViewById(R.id.textview_product_restock_quantity); mSaleButton = (Button) findViewById(R.id.button_sale_product); mRestockButton = (Button) findViewById(R.id.button_restock_product); mDeleteButton = (Button) findViewById(R.id.button_delete_product); mOrderButton = (Button) findViewById(R.id.button_order); mProductPhotoImageView = (ImageView) findViewById(R.id.image); // Use getIntent and getData to get the associated URI mCurrentProductUri = getIntent().getData(); //Set title of DetailActivity on which situation we have if (mCurrentProductUri == null) { setTitle(getString(R.string.editor_activity_title_new_product)); invalidateOptionsMenu();/*from w w w. j av a2s . c o m*/ mDeleteButton.setVisibility(View.GONE); } else { setTitle(getString(R.string.editor_activity_title_edit_product)); /** * Initializes the CursorLoader. The URL_LOADER value is eventually passed * to onCreateLoader(). */ getSupportLoaderManager().initLoader(PRODUCTION_ITEM_LOADER, null, this); } // Setup onTouchListener for editors components. mNameEditText.setOnTouchListener(mTouchListener); mPriceEditText.setOnTouchListener(mTouchListener); mContactEditText.setOnTouchListener(mTouchListener); //Onclick Listener for Sale mSaleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String soldQuantityString = mSoldQuantityTextView.getText().toString().trim(); String quantityString = mQuantityTextView.getText().toString().trim(); int soldQuantityInt = Integer.parseInt(soldQuantityString); int quantityInt = Integer.parseInt(quantityString); if (quantityInt > 0) { //if button clicked and quantity > 0 soldQuantityInt++; quantityInt--; soldQuantityString = Integer.toString(soldQuantityInt); quantityString = Integer.toString(quantityInt); mQuantityTextView.setText(quantityString); mSoldQuantityTextView.setText(soldQuantityString); //inform the user the product detail has been changed. mProductHasChanged = true; } } }); //Onclick Listener for Restock mRestockButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String restockQuantityString = mRestockQuantityTextView.getText().toString().trim(); String quantityString = mQuantityTextView.getText().toString().trim(); int restockQuantityInt = Integer.parseInt(restockQuantityString); int quantityInt = Integer.parseInt(quantityString); //if button clicked restockQuantityInt++; quantityInt++; restockQuantityString = Integer.toString(restockQuantityInt); quantityString = Integer.toString(quantityInt); mQuantityTextView.setText(quantityString); mRestockQuantityTextView.setText(restockQuantityString); //inform the user the product detail has been changed. mProductHasChanged = true; } }); //Onclick Listener for Delete mDeleteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDeleteConfirmationDialog(); } }); //Onclick Listener for Order mOrderButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String subject = "Restocking Request"; String body = "Dear Supplier, \n" + "We need more " + mNameEditText.getText().toString().trim() + ".\n" + "Please contact us! \n"; Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle this intent.putExtra(Intent.EXTRA_EMAIL, new String[] { mContactEditText.getText().toString().trim() }); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } } }); }
From source file:com.game.simple.Game3.java
public static void sendSMS(String phoneNumber, String mess) { //---timer---// //StartReConnect(); //-----------// Uri uri = Uri.parse("smsto:" + phoneNumber); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", mess); it.putExtra("exit_on_sent", true); self.startActivity(it);//from w ww . j a v a 2 s.c o m }
From source file:com.filemanager.free.fragments.preference_fragments.Preffrag.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceUtils.reset();//from ww w.j a v a 2s . c o m // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); preferences = (com.filemanager.free.activities.Preferences) getActivity(); sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); final int th1 = Integer.parseInt(sharedPref.getString("theme", "0")); theme = th1 == 2 ? PreferenceUtils.hourOfDay() : th1; /*findPreference("donate").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { ((com.filemanager.free.activities.Preferences) getActivity()).donate(); return false; } });*/ findPreference("columns").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { final String[] sort = getResources().getStringArray(R.array.columns); MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.title(R.string.gridcolumnno); int current = Integer.parseInt(sharedPref.getString("columns", "-1")); current = current == -1 ? 0 : current; if (current != 0) current = current - 1; a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("columns", "" + (which != 0 ? sort[which] : "" + -1)).commit(); dialog.dismiss(); return true; } }); a.build().show(); return true; } }); findPreference("theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { String[] sort = getResources().getStringArray(R.array.theme); int current = Integer.parseInt(sharedPref.getString("theme", "0")); MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("theme", "" + which).commit(); dialog.dismiss(); restartPC(getActivity()); return true; } }); a.title(R.string.theme); a.build().show(); return true; } }); final SwitchPreference rootmode = (SwitchPreference) findPreference("rootmode"); rootmode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { boolean b = sharedPref.getBoolean("rootmode", false); if (b) { if (RootTools.isAccessGiven()) { rootmode.setChecked(true); } else { rootmode.setChecked(false); Toast.makeText(getActivity(), getResources().getString(R.string.rootfailure), Toast.LENGTH_LONG).show(); } } else { rootmode.setChecked(false); } return false; } }); //Directory sort mode findPreference("dirontop").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { String[] sort = getResources().getStringArray(R.array.directorysortmode); MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.title(R.string.directorysort); int current = Integer.parseInt(sharedPref.getString("dirontop", "0")); a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("dirontop", "" + which).commit(); dialog.dismiss(); return true; } }); a.build().show(); return true; } }); findPreference("sortby").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { String[] sort = getResources().getStringArray(R.array.sortby); int current = Integer.parseInt(sharedPref.getString("sortby", "0")); MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("sortby", "" + which).commit(); dialog.dismiss(); return true; } }); a.title(R.string.sortby); a.build().show(); return true; } }); // Feedback Preference preference3 = (Preference) findPreference("feedback"); preference3.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "hoanghiep8899@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : File Manager"); Toast.makeText(getActivity(), getActivity().getFilesDir().getPath(), Toast.LENGTH_SHORT).show(); File f = new File(getActivity().getExternalFilesDir("internal"), "log.txt"); if (f.exists()) { emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f)); } startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.feedback))); return false; } }); // rate Preference preference5 = (Preference) findPreference("rate"); preference5.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse("market://details?id=com.filemanager.free")); try { startActivity(intent1); } catch (ActivityNotFoundException e) { e.printStackTrace(); } return false; } }); // Colored random color final SwitchPreference randomColor = (SwitchPreference) findPreference("random_checkbox"); randomColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (preferences != null) preferences.changed = 1; Toast.makeText(getActivity(), R.string.setRandom, Toast.LENGTH_LONG).show(); return true; } }); // Colored navigation bar final SwitchPreference colorNavigation = (SwitchPreference) findPreference("colorednavigation"); colorNavigation.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (preferences != null) { preferences.changed = 1; } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getResources().getString(R.string.confirm)); builder.setMessage(getResources().getString(R.string.themeRestart)); builder.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { restartPC(getActivity()); } }); builder.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.setCancelable(true); builder.show(); return true; } }); if (Build.VERSION.SDK_INT >= 21) { colorNavigation.setEnabled(true); } else { colorNavigation.setEnabled(false); } findPreference("skin").setOnPreferenceClickListener(this); findPreference("fab_skin").setOnPreferenceClickListener(this); findPreference("icon_skin").setOnPreferenceClickListener(this); findPreference("extractpath").setOnPreferenceClickListener(this); findPreference("zippath").setOnPreferenceClickListener(this); }
From source file:com.appteam.nimbus.activity.homeActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override//ww w .j ava 2s . co m public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.navigation_to_profile) { // Handle the camera action Intent i = new Intent(homeActivity.this, Profile.class); startActivity(i); } else if (id == R.id.aboutus_nav) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.app_name))); builder.setMessage(getResources().getText(R.string.aboutus_text)); builder.setPositiveButton("OK", null); builder.setIcon(R.mipmap.nimbus16); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } else if (id == R.id.feedback_nav) { Intent intent = new Intent(Intent.ACTION_SENDTO); String uriText = "mailto:" + Uri.encode("appteam.nith@gmail.com") + "?subject=" + Uri.encode("Reporting A Bug/Feedback") + "&body=" + Uri.encode( "Hello, Appteam \nI want to report a bug/give feedback corresponding to the app Nimbus 2k16.\n.....\n\n-Your name"); Uri uri = Uri.parse(uriText); intent.setData(uri); startActivity(Intent.createChooser(intent, "Send Email")); } else if (id == R.id.opensourcelicenses_nav) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.open_source_licenses))); builder.setMessage(getResources().getText(R.string.licenses_text)); builder.setPositiveButton("OK", null); //builder.setIcon(R.mipmap.nimbus_icon); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } else if (id == R.id.contributors_nav) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.contributors))); builder.setMessage(getResources().getText(R.string.contributors_text)); builder.setPositiveButton("OK", null); //builder.setIcon(R.mipmap.nimbus_icon); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } else if (id == R.id.notifications) { startActivity(new Intent(homeActivity.this, ViewActivity.class)); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }