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 createShortcutIntent(String url) { Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); long urlHash = url.hashCode(); long uniqueId = (urlHash << 32) | shortcutIntent.hashCode(); shortcutIntent.putExtra(Browser.EXTRA_APPLICATION_ID, Long.toString(uniqueId)); return shortcutIntent; }
From source file:Main.java
public static void sendFeedback2(Context context) { String versionName = ""; try {// w ww .j a v a 2 s . co m versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { e.printStackTrace(); } StringBuffer sb = new StringBuffer(); sb.append("We would like to hear your feedback and improvement ideas. Please feel free to share below :") .append("\r\n").append("\r\n").append("\r\n").append("Attach Screenshots (if any) : ") .append("\r\n").append("\r\n").append("\r\n").append("Running on ").append(android.os.Build.MODEL) .append("\r\n").append("OS Version : ").append(android.os.Build.VERSION.RELEASE).append("\r\n") .append("Client Version : ").append(versionName); Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "messageplus_feedback@starhub.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Message+ - Feedback"); emailIntent.putExtra(Intent.EXTRA_TEXT, sb.toString()); context.startActivity(Intent.createChooser(emailIntent, "Choose email client")); }
From source file:Main.java
public static void jumpToActivity(Context context, Class<? extends Activity> targetClass, String... datas) { Intent datatIntent = new Intent(context, targetClass); if (datas != null) { for (int i = 0; i < datas.length; ++i) { datatIntent.putExtra("data" + i, datas[i]); }/* ww w . j av a2 s . c o m*/ } context.startActivity(datatIntent); }
From source file:Main.java
/** * Open an URL in a message./*from ww w.j a v a 2 s . c om*/ * * This is intended to mirror the operation of the original * (see android.webkit.CallbackProxy) with one addition of intent flags * "FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET". This improves behavior when sublaunching * other apps via embedded URI's. * * We also use this hook to catch "mailto:" links and handle them locally. * * @param activity parent activity * @param url URL to open * @param senderAccountId if the URL is mailto:, we use this account as the sender. * TODO When MessageCompose implements the account selector, this won't be necessary. * Pass {@link Account#NO_ACCOUNT} to use the default account. * @return true if the URI has successfully been opened. */ public static boolean openUrlInMessage(Activity activity, String url, long senderAccountId) { // hijack mailto: uri's and handle locally //*** //if (url != null && url.toLowerCase().startsWith("mailto:")) { // return MessageCompose.actionCompose(activity, url, senderAccountId); //} // Handle most uri's via intent launch boolean result = false; Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.putExtra(Browser.EXTRA_APPLICATION_ID, activity.getPackageName()); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); try { activity.startActivity(intent); result = true; } catch (ActivityNotFoundException ex) { // No applications can handle it. Ignore. } return result; }
From source file:com.tealeaf.PushBroadcastReceiver.java
public static void scheduleNext(Context context, int timeout) { TeaLeafOptions options = new TeaLeafOptions(context); String appID = options.getAppID(); logger.log("{push} Scheduling the next push for", timeout); Intent intent = new Intent("com.tealeaf.CHECK_PUSH_SERVER"); intent.putExtra("appID", appID); AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); scheduledIntent = PendingIntent.getBroadcast(context, 0, intent, 0); alarms.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (timeout * 1000), scheduledIntent); }
From source file:Main.java
public static void shareApkInfo(String info, Context context) { Intent intent = new Intent(); intent.setAction("android.intent.action.SEND"); intent.addCategory("android.intent.category.DEFAULT"); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, info); context.startActivity(intent);/*from w w w . ja v a 2s . c o m*/ }
From source file:Main.java
@SuppressLint("InlinedApi") public static void launchPlainText(Context context, String text, CharSequence chooserTitle) { // See http://android-developers.blogspot.com/2012/02/share-with-intents.html Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); intent.putExtra(Intent.EXTRA_TEXT, text); // intent.putExtra( Intent.EXTRA_SUBJECT, subject ); // intent.putExtra( Intent.EXTRA_EMAIL, new String[] { emailTo } ); context.startActivity(Intent.createChooser(intent, chooserTitle)); }
From source file:Main.java
public static void ShareApplication(Context mContext) { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intent.EXTRA_SUBJECT, "Search Sri Lanka Railway Time Table"); intent.putExtra(Intent.EXTRA_TITLE, "Search Sri Lanka Railway Time Table"); intent.putExtra(Intent.EXTRA_TEXT,/*from ww w. j a v a 2 s .c om*/ "Search \"Sri Lanka Railway Time Table\" on your Android. http://market.android.com/details?id=com.aselalee.trainschedule"); mContext.startActivity(Intent.createChooser(intent, "Spread the word")); return; }
From source file:com.appnexus.opensdk.PBImplementation.java
private static void sendBroadcast(Context context, String auctionInfo, byte[] imageBytes) { String dataUrl = URL_BROADCAST_PREFIX + Uri.encode(auctionInfo); Intent intent = new Intent(ACTION_BROADCAST, Uri.parse(dataUrl)); intent.putExtra(KEY_IMAGE, imageBytes); context.sendBroadcast(intent);//from ww w . ja v a2 s . c o m }
From source file:Main.java
@SuppressLint("NewApi") public static void sendSchemeForResultAddMediaStack(Fragment activity, String mediaActivityUrl, String url, int requestCode, Bundle bundle) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(mediaActivityUrl)); intent.putExtra(TARGET_SCHEME_URI, url); if (bundle != null) { intent.putExtras(bundle);/*from w w w. j a v a 2s . co m*/ } activity.startActivityForResult(intent, requestCode); }