List of usage examples for android.content Intent putExtra
@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value)
From source file:Main.java
public static void sendStringByMail(Context c, String string) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "DROIDSHEEP DEBUG INFORMATION"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, string); c.startActivity(Intent.createChooser(emailIntent, "Send mail...")); }
From source file:Main.java
public static void shareOnTwitter(Context pContext, String urlToShare) { Intent tweetIntent = new Intent(Intent.ACTION_SEND); tweetIntent.putExtra(Intent.EXTRA_TEXT, urlToShare); tweetIntent.setType("text/plain"); PackageManager packManager = pContext.getPackageManager(); List<ResolveInfo> resolvedInfoList = packManager.queryIntentActivities(tweetIntent, PackageManager.MATCH_DEFAULT_ONLY); boolean resolved = false; for (ResolveInfo resolveInfo : resolvedInfoList) { if (resolveInfo.activityInfo.packageName.startsWith("com.twitter.android")) { tweetIntent.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name); resolved = true;//from w w w . j a v a 2s . com break; } } if (resolved) { pContext.startActivity(tweetIntent); } else { Intent i = new Intent(); i.putExtra(Intent.EXTRA_TEXT, urlToShare); i.setAction(Intent.ACTION_VIEW); i.setData(Uri.parse("https://twitter.com/intent/tweet?text=message&via=profileName")); pContext.startActivity(i); } }
From source file:Main.java
public static Intent capturePhoto(Uri output) { final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (output != null) { intent.putExtra(MediaStore.EXTRA_OUTPUT, output); }//from www.j a va 2 s.com return intent; }
From source file:Main.java
public static void startCamera(Activity activity, int requestCode, File outPath) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Uri uri = Uri.fromFile(outPath);//from w w w .jav a 2s.co m intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); activity.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static Intent captureVideo(Uri output) { final Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); if (output != null) { intent.putExtra(MediaStore.EXTRA_OUTPUT, output); }/* ww w . j av a2 s.c o m*/ return intent; }
From source file:Main.java
public static Intent getVideoFileIntent(String param) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("oneshot", 0); intent.putExtra("configchange", 0); Uri uri = Uri.fromFile(new File(param)); intent.setDataAndType(uri, "video/*"); return intent; }
From source file:Main.java
public static Intent getAudioFileIntent(String param) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("oneshot", 0); intent.putExtra("configchange", 0); Uri uri = Uri.fromFile(new File(param)); intent.setDataAndType(uri, "audio/*"); return intent; }
From source file:Main.java
public static void setBadge(Context context, int count) { String launcherClassName = getLauncherClassName(context); if (launcherClassName == null) { return;//from w w w . j ava2 s.c o m } Intent intent = new Intent("android.intent.action.BADGE_COUNT_UPDATE"); intent.putExtra("badge_count", count); intent.putExtra("badge_count_package_name", context.getPackageName()); intent.putExtra("badge_count_class_name", launcherClassName); context.sendBroadcast(intent); }
From source file:Main.java
/** * Create a precondition activity intent. * @param activity the original activity * @param preconditionActivityClazz the precondition activity's class * @return an intent which will launch the precondition activity. *//*from ww w .j ava2s .c om*/ public static Intent createPreconditionIntent(Activity activity, Class preconditionActivityClazz) { Intent newIntent = new Intent(); newIntent.setClass(activity, preconditionActivityClazz); newIntent.putExtra(EXTRA_WRAPPED_INTENT, activity.getIntent()); return newIntent; }
From source file:Main.java
public static void samsungShortCut(Context context, String num) { int numInt = Integer.valueOf(num); if (numInt < 1) { num = "0"; } else if (numInt > 99) { num = "99"; }//from w w w.j av a 2s . co m String activityName = getLaunchActivityName(context); Intent localIntent = new Intent("android.intent.action.BADGE_COUNT_UPDATE"); localIntent.putExtra("badge_count", Integer.parseInt(num)); localIntent.putExtra("badge_count_package_name", context.getPackageName()); localIntent.putExtra("badge_count_class_name", activityName); context.sendBroadcast(localIntent); }