List of usage examples for android.content Intent setType
public @NonNull Intent setType(@Nullable String type)
From source file:free.yhc.netmbuddy.utils.Utils.java
public static void sendMail(Context context, String receiver, String subject, String text, File attachment) { if (!Utils.isNetworkAvailable()) return;// w w w . ja v a 2 s . c o m Intent intent = new Intent(Intent.ACTION_SEND); if (null != receiver) intent.putExtra(Intent.EXTRA_EMAIL, new String[] { receiver }); intent.putExtra(Intent.EXTRA_TEXT, text); intent.putExtra(Intent.EXTRA_SUBJECT, subject); if (null != attachment) intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachment)); intent.setType("message/rfc822"); try { context.startActivity(intent); } catch (ActivityNotFoundException e) { UiUtils.showTextToast(context, R.string.msg_fail_find_app); } }
From source file:com.partypoker.poker.engagement.reach.EngagementAnnouncement.java
@Override Intent buildIntent() {/*from w w w . ja va2 s . c o m*/ Intent intent = new Intent(INTENT_ACTION); intent.setType(getType()); String category = getCategory(); if (category != null) intent.addCategory(category); return intent; }
From source file:com.manning.androidhacks.hack035.MainActivity.java
public void onPickPicture(View v) { Intent pickIntent = new Intent(Intent.ACTION_GET_CONTENT); pickIntent.setType("image/*"); Intent chooserIntent = Intent.createChooser(pickIntent, getString(R.string.activity_main_take_picture)); startActivityForResult(chooserIntent, PICK_PICTURE); }
From source file:com.manning.androidhacks.hack035.MainActivity.java
public void onPickBoth(View v) { Intent pickIntent = new Intent(Intent.ACTION_GET_CONTENT); pickIntent.setType("image/*"); Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Intent chooserIntent = Intent.createChooser(pickIntent, getString(R.string.activity_main_pick_both)); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { takePhotoIntent }); startActivityForResult(chooserIntent, PICK_OR_TAKE_PICTURE); }
From source file:com.ideateam.plugin.Emailer.java
private void SendEmail(String email, String subject, String text, String attachFile) { String attachPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/UAR2015/" + attachFile; File file = new File(attachPath); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { email }); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(text)); this.cordova.getActivity().startActivity(Intent.createChooser(intent, "Send email...")); }
From source file:com.elkriefy.android.apps.chubbytabby.activity.MainActivity.java
private PendingIntent createPendingShareIntent() { Intent actionIntent = new Intent(Intent.ACTION_SEND); actionIntent.setType("text/html"); actionIntent.putExtra(Intent.EXTRA_TEXT, "This is the Chubby Bunny Challenge/n" + URL); return PendingIntent.getActivity(getApplicationContext(), 0, actionIntent, 0); }
From source file:edu.stanford.mobisocial.dungbeetle.obj.action.ExportPhotoAction.java
@Override public void onAct(Context context, DbEntryHandler objType, DbObj obj) { byte[] raw = obj.getRaw(); if (raw == null) { String b64Bytes = obj.getJson().optString(PictureObj.DATA); raw = FastBase64.decode(b64Bytes); }/*from w w w . ja va2 s . c om*/ OutputStream outStream = null; File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/temp_share.png"); try { outStream = new FileOutputStream(file); BitmapManager mgr = new BitmapManager(1); Bitmap bitmap = mgr.getBitmap(raw.hashCode(), raw); bitmap.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); bitmap.recycle(); bitmap = null; System.gc(); Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("image/png"); Log.w("ResharePhotoAction", Environment.getExternalStorageDirectory().getAbsolutePath() + "/temp_share.png"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); context.startActivity(Intent.createChooser(intent, "Export image to")); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.battlelancer.seriesguide.ui.HelpActivity.java
private void sendEmail() { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType(HTTP.PLAIN_TEXT_TYPE); intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { SeriesGuidePreferences.SUPPORT_MAIL }); intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "SeriesGuide " + Utils.getVersion(this) + " Feedback"); intent.putExtra(android.content.Intent.EXTRA_TEXT, ""); Intent chooser = Intent.createChooser(intent, getString(R.string.feedback)); Utils.tryStartActivity(this, chooser, true); }
From source file:com.autburst.picture.FinishedUploadActivity.java
private void sendLink() { String url = createVideoUrl(); if (url == null) { return;/*from w w w . ja v a 2 s.c om*/ } Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); Resources res = getResources(); i.putExtra(Intent.EXTRA_SUBJECT, res.getString(R.string.downloadlink)); i.putExtra(Intent.EXTRA_TEXT, url); startActivity(Intent.createChooser(i, res.getString(R.string.sendlink))); }