List of usage examples for android.content Intent putExtra
@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value)
From source file:com.fanfou.app.opensource.service.DownloadService.java
public static Intent getNewVersionIntent(final Context context, final AppVersionInfo info) { final Intent intent = new Intent(context, NewVersionPage.class); intent.putExtra(Constants.EXTRA_DATA, info); return intent; }
From source file:com.fanfou.app.opensource.service.DownloadService.java
private final static PendingIntent getPendingIntent(final Context context) { final Intent intent = new Intent(context, DownloadService.class); intent.putExtra(Constants.EXTRA_TYPE, DownloadService.TYPE_CHECK); final PendingIntent pi = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); return pi;//w w w .ja va 2 s . c o m }
From source file:com.fanfou.app.opensource.service.DownloadService.java
public static void startDownload(final Context context, final AppVersionInfo info) { final Intent intent = new Intent(context, DownloadService.class); intent.putExtra(Constants.EXTRA_TYPE, DownloadService.TYPE_DOWNLOAD); intent.putExtra(Constants.EXTRA_URL, info); context.startService(intent);//from ww w .j a va 2s. c o m }
From source file:org.openbitcoinwidget.WidgetProvider.java
private static void updateAppWidget(final Context context, AppWidgetManager appWidgetManager, int appWidgetId) { WidgetPreferences preferences = PreferencesActivity.getWidgetPreferences(context, appWidgetId); if (preferences == null) { // Don't do anything unless the rate service has been chosen. // Show a "please remove this widget and add a new one" appWidgetManager.updateAppWidget(appWidgetId, new RemoteViews(context.getPackageName(), R.layout.appwidget_replace_me)); return;//from w w w.j ava2 s .c o m } boolean isOnLockScreen = isWidgetShownOnLockScreen(appWidgetManager, appWidgetId); RemoteViews views; if (isOnLockScreen) { views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider_lock_screen); } else { views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider); } Intent clickIntent = new Intent(context, GraphPopupActivity.class); clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); clickIntent.setAction("dummyAction"); // Needed to get the extra variables included in the call // Note: the appWidgetId needs to be sent in the pendingIntent as request code, otherwise only ONE // cached intent will be used for all widget instances! PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId, clickIntent, 0); views.setOnClickPendingIntent(R.id.appwidget_box, pendingIntent); views.setTextViewText(R.id.appwidget_service_name, preferences.getRateService().getName()); DataOpenHelper dbHelper = new DataOpenHelper(context); TickerData prevData = dbHelper.getLastTickerData(preferences); TickerData newData; String latestQuote = getLatestQuote(preferences); if (latestQuote != null && !latestQuote.equals("")) { newData = preferences.getRateService().parseJSON(latestQuote); newData.setCurrencyConversion(preferences.getCurrencyConversion()); storeLastValueIfNotNull(dbHelper, newData); updateViews(views, prevData, newData, preferences); } else if (prevData != null) { newData = prevData; updateViews(views, prevData, newData, preferences); } else { updateViewsWithError(views, preferences); } appWidgetManager.updateAppWidget(appWidgetId, views); }
From source file:at.wada811.utils.IntentUtils.java
/** * ?Intent??// w w w . j a v a 2 s . com */ public static Intent createSendTextIntent(String text) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, text); return intent; }
From source file:com.ibuildapp.romanblack.CataloguePlugin.model.ShoppingCart.java
/** * Send order to endpoint/*from w w w . ja va 2 s . c om*/ * * @param context context * @param userProfile userProfile */ public static void sendOrder(final Context context, final UserProfile userProfile) { SqlAdapter.insertUserProfile(userProfile); progressDialog = ProgressDialog.show(context, null, context.getResources().getString(R.string.shopping_cart_loading), true, true); CatalogApi api = (new CatalogApiService(com.appbuilder.sdk.android.Statics.BASE_DOMEN)).getCatalogApi(); api.sendOrder(String.valueOf(com.ibuildapp.romanblack.CataloguePlugin.Statics.appId), String.valueOf(com.ibuildapp.romanblack.CataloguePlugin.Statics.widgetId), toShippingForm(), toItems()).subscribeOn(Schedulers.io()).subscribe(new Subscriber<ApiResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { if (context instanceof Activity) ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { progressDialog.dismiss(); progressDialog = null; } }); } @Override public void onNext(ApiResponse apiResponse) { if ("complete".equals(apiResponse.getStatus())) { if (context instanceof Activity) { Intent intent = new Intent(context, ThankYouPage.class); intent.putExtra(EXTRA_ORDER_NUMBER, apiResponse.getOrderNumber()); ((Activity) context).startActivityForResult(intent, ShoppingCartPage.REQUEST_EXIT); } } else { if (context instanceof Activity) ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, context.getString(R.string.shopping_cart_send_error), Toast.LENGTH_SHORT).show(); } }); } if (context instanceof Activity) ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { progressDialog.dismiss(); progressDialog = null; } }); } }); }
From source file:com.prasanna.android.stacknetwork.utils.MarkdownFormatter.java
private static RelativeLayout getTextViewForCode(final Context context, final String text) { final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final RelativeLayout codeLayout = (RelativeLayout) inflater.inflate(R.layout.code, null); final WebView webView = (WebView) codeLayout.findViewById(R.id.code); loadText(webView, text);/* w w w . j a v a 2s. c o m*/ StackXQuickActionMenu quickActionMenu = new StackXQuickActionMenu(context) .addEmailQuickActionItem("Code sample from StackX", text).addCopyToClipboardItem(text); final QuickActionMenu actionMenu = quickActionMenu.addItem(R.string.fullscreen, new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, FullscreenTextActivity.class); intent.putExtra(StringConstants.TEXT, text); context.startActivity(intent); } }).build(); ImageView imageView = (ImageView) codeLayout.findViewById(R.id.codeQuickActionMenu); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { actionMenu.show(v); } }); return codeLayout; }
From source file:im.delight.android.baselib.Social.java
/** * Constructs an Intent for sharing/sending a file and starts Activity chooser for that Intent * * @param context Context reference to start the Activity chooser from * @param windowTitle the string to be used as the window title for the Activity chooser * @param file the File instance to be shared * @param mimeType the MIME type for the file to be shared (e.g. image/jpeg) * @param messageTitle the message title/subject that may be provided in addition to the file, if supported by the target app *//*from www . jav a 2 s . c om*/ public static void shareFile(Context context, String windowTitle, File file, final String mimeType, String messageTitle) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType(mimeType); intent.putExtra(Intent.EXTRA_SUBJECT, messageTitle); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); context.startActivity(Intent.createChooser(intent, windowTitle)); }
From source file:im.delight.android.commons.Social.java
/** * Displays an application chooser and shares the specified plain text and subject line using the selected application * * @param context a context reference/*from ww w . ja v a 2s . c o m*/ * @param windowTitle the title for the application chooser's window * @param bodyTextToShare the body text to be shared * @param subjectTextToShare the title or subject for the message to be shared, if supported by the target application */ public static void shareText(final Context context, final String windowTitle, final String bodyTextToShare, final String subjectTextToShare) { final Intent intentInvite = new Intent(Intent.ACTION_SEND); intentInvite.setType(HTTP.PLAIN_TEXT_TYPE); intentInvite.putExtra(Intent.EXTRA_SUBJECT, subjectTextToShare); intentInvite.putExtra(Intent.EXTRA_TEXT, bodyTextToShare); context.startActivity(Intent.createChooser(intentInvite, windowTitle)); }
From source file:com.ruesga.rview.misc.ActivityHelper.java
public static void handleUri(Context ctx, Uri uri) { try {//from w w w.j a v a 2 s . c o m Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.putExtra(Constants.EXTRA_FORCE_SINGLE_PANEL, true); intent.putExtra(Constants.EXTRA_HAS_PARENT, true); intent.putExtra(Constants.EXTRA_SOURCE, ctx.getPackageName()); intent.setPackage(ctx.getPackageName()); ctx.startActivity(intent); } catch (ActivityNotFoundException ex) { // Fallback to default browser String msg = ctx.getString(R.string.exception_browser_not_found, uri.toString()); Toast.makeText(ctx, msg, Toast.LENGTH_SHORT).show(); } }