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 resultSetParameter(Activity context, int resultCode, String extraName, float extraValue) { Intent intent = new Intent(); intent.putExtra(extraName, extraValue); context.setResult(resultCode, intent); }
From source file:Main.java
public static void resultSetParameter(Activity context, int resultCode, String extraName, float[] extraValue) { Intent intent = new Intent(); intent.putExtra(extraName, extraValue); context.setResult(resultCode, intent); }
From source file:Main.java
public static void sendBroadcast(Context context, String filter, String name, String value, String name1, String value1) {//from w ww . ja v a 2s .c o m Intent intent = new Intent(); intent.putExtra(name, value); intent.putExtra(name1, value1); intent.setAction(filter); context.sendBroadcast(intent); }
From source file:Main.java
public static Intent createShareIntent(String title, String text) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("content/plain"); intent.putExtra(Intent.EXTRA_TEXT, text); return Intent.createChooser(intent, title); }
From source file:Main.java
/** * Notifies UI to display a message.//www. j a va 2 s. c om * <p> * This method is defined in the common helper because it's used both by * the UI and the background service. * * @param context application's context. * @param message message to be displayed. */ static void displayMessage(Context context, String message) { Intent intent = new Intent(DISPLAY_MESSAGE_ACTION); intent.putExtra(EXTRA_MESSAGE, message); context.sendBroadcast(intent); }
From source file:Main.java
public static void putExtra(Intent intent, String key, String value) { if (value != null && value.length() > 0) { intent.putExtra(key, value); }//from www.j a va2s.c om }
From source file:Main.java
public static Intent getCaptureIntent(Uri uri) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (uri != null) { intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); }/* ww w . j a v a 2 s . co m*/ return intent; }
From source file:Main.java
public static void resultSetParameter(Activity context, int resultCode, String extraName, Parcelable extraValue) {//www . ja v a2 s.c o m Intent intent = new Intent(); intent.putExtra(extraName, extraValue); context.setResult(resultCode, intent); }
From source file:Main.java
public static Boolean sendSms(Context mContext, String smstext) { Uri smsToUri = Uri.parse("smsto:"); Intent mIntent = new Intent(android.content.Intent.ACTION_SENDTO, smsToUri); mIntent.putExtra("sms_body", smstext); mContext.startActivity(mIntent);//from w ww .j av a 2 s .co m return null; }
From source file:Main.java
public static boolean share(Context context, String title, String content) { Intent send = new Intent(Intent.ACTION_SEND); send.setType("text/plain"); send.putExtra(Intent.EXTRA_TEXT, content); send.putExtra(Intent.EXTRA_SUBJECT, title); try {/*from w w w . j a v a 2 s . c o m*/ context.startActivity(Intent.createChooser(send, content)); } catch (android.content.ActivityNotFoundException ex) { return false; } return true; }