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 Intent share(final String content) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, content); sendIntent.setType("text/plain"); return sendIntent; }
From source file:Main.java
public static void enableDiscoverable(Context context) { Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300); context.startActivity(discoverableIntent); }
From source file:Main.java
public static Intent createShareIntent(String string) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, string); return intent; }
From source file:Main.java
public static void startActivity(Activity context, Class clazz, Bundle bundle) { if (context != null) { try {// ww w .j ava2 s. c o m Intent intent = new Intent(context, clazz); intent.putExtra("bundle", bundle); context.startActivity(intent); } catch (ActivityNotFoundException e) { e.printStackTrace(); } } }
From source file:Main.java
public static void shareText(Activity activity, String title, String text) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, text); sendIntent.setType("text/plain"); activity.startActivity(Intent.createChooser(sendIntent, title)); }
From source file:Main.java
public static void feedback(Context context, String feedBackEmailId, String emailSubject, String msg) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { feedBackEmailId }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); emailIntent.putExtra(Intent.EXTRA_TEXT, msg); emailIntent.setType("message/rfc822"); emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (isIntentAvailable(context, emailIntent)) { context.startActivity(emailIntent); } else {//w ww .j a va 2s.c om Toast.makeText(context, "No Email Application Found", Toast.LENGTH_LONG).show(); } }
From source file:Main.java
public static Intent getShareTextIntent(String content) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, content); return intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); }
From source file:Main.java
public static void share(Context pContext, String urlToShare, String titleChosser, String subject) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, urlToShare); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); pContext.startActivity(Intent.createChooser(intent, titleChosser)); }
From source file:Main.java
public static void startActivity(Context packageContext, Class<?> cls, String personId) { Intent intent = new Intent(packageContext, cls); if (personId != "") { intent.putExtra("personId", personId); }/*from w w w. ja v a 2 s . com*/ packageContext.startActivity(intent); }
From source file:Main.java
public static void shareAppInfo(Context context, String info) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, info); context.startActivity(intent);/* w w w. j av a2s .co m*/ }