List of usage examples for android.content Intent putExtra
@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value)
From source file:com.diona.videoplugin.CameraUtil.java
/** * Method to get a video clip.// www .j a v a 2 s . c om * * @param fragment * fragment instance that holds the callback method for the camera utility. */ public static void getVideoFromCamera(final Fragment fragment) { callingActivity = fragment; /*final SocialWorkerSharedPreferences preferences = SocialWorkerSharedPreferences.getInstance(); final Intent videoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, preferences.getVideoQuality()); final long videoSize = preferences.getVideoSize(); if (videoSize > 0) { videoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, videoSize); } final int videoDuration = preferences.getVideoDuration(); if (videoDuration > 0) { videoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, videoDuration); } videoIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileCacheUtil.getOutputMediaFileUriForVideos()); callingActivity.startActivityForResult(videoIntent, VIDEO_REQUEST);*/ final Intent videoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); //final long videoSize = preferences.getVideoSize(); /* if (videoSize > 0) { videoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 100); }*/ //final int videoDuration = preferences.getVideoDuration(); /*if (videoDuration > 0) { videoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 60); }*/ videoIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileCacheUtil.getOutputMediaFileUriForVideos()); callingActivity.startActivityForResult(videoIntent, VIDEO_REQUEST); }
From source file:ch.fixme.status.Widget.java
protected static void updateWidget(final Context ctxt, int widgetId, AppWidgetManager manager, Bitmap bitmap, String text) {/*from w w w. j a v a 2 s . c om*/ RemoteViews views = new RemoteViews(ctxt.getPackageName(), R.layout.widget); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctxt); Editor edit = prefs.edit(); if (prefs.getBoolean(Prefs.KEY_WIDGET_TRANSPARENCY, Prefs.DEFAULT_WIDGET_TRANSPARENCY)) { views.setInt(R.id.widget_image, "setBackgroundResource", 0); } else { views.setInt(R.id.widget_image, "setBackgroundResource", android.R.drawable.btn_default_small); } if (bitmap != null) { views.setImageViewBitmap(R.id.widget_image, bitmap); edit.putBoolean(Main.PREF_FORCE_WIDGET + widgetId, false); // Don't // need // to // force } else { views.setImageViewResource(R.id.widget_image, android.R.drawable.ic_popup_sync); edit.putBoolean(Main.PREF_FORCE_WIDGET + widgetId, true); // Something // went // wrong } if (text != null) { views.setTextViewText(R.id.widget_status, text); views.setViewVisibility(R.id.widget_status, View.VISIBLE); } else { views.setViewVisibility(R.id.widget_status, View.GONE); } Intent clickIntent = new Intent(ctxt, Main.class); clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId); PendingIntent pendingIntent = PendingIntent.getActivity(ctxt, widgetId, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT); views.setOnClickPendingIntent(R.id.widget_image, pendingIntent); manager.updateAppWidget(widgetId, views); // Is initialized edit.putBoolean(Main.PREF_INIT_WIDGET + widgetId, true); edit.commit(); }
From source file:com.upnext.blekit.actions.BLEAction.java
/** * Displays a notification/*from ww w . j a v a 2s . c o m*/ * * @param context Android Context, passed from the calling entity * @param title title for the notification * @param msg message and ticker for the notification * @param type action type that will be put as an extra into the result Intent (<code>resultIntent.putExtra("type", type);</code>) * @param notificationIconResId notification icon resource id * @param notificationId an identifier for this notification as in {@link android.app.NotificationManager#notify(int, android.app.Notification)} */ public static void displayNotification(Context context, String title, String msg, String type, int notificationIconResId, int notificationId) { L.d("."); if (BLEKit.getTargetActivityForNotifications() == null) { throw new IllegalArgumentException( "Target activity for notifications is not set. Call BLEKit.getTargetActivityForNotifications() first."); } Notification.Builder builder = new Notification.Builder(context).setContentText(msg).setTicker(msg) .setContentTitle(title).setAutoCancel(true).setSmallIcon(notificationIconResId); Intent resultIntent = new Intent(context, BLEKit.getTargetActivityForNotifications()); resultIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); resultIntent.putExtra("type", type); PendingIntent resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(resultPendingIntent); NotificationManager mNotificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(notificationId, builder.build()); }
From source file:com.android.example.devsummit.archdemo.view.activity.FeedActivity.java
public static Intent intentForSendPost(Context context, String postContent) { Intent intent = new Intent(context, FeedActivity.class); intent.putExtra(EXTRA_POST_TEXT, postContent); return intent; }
From source file:com.android.example.devsummit.archdemo.view.activity.FeedActivity.java
public static Intent intentFor(Context context, long userId, String userName) { Intent intent = new Intent(context, FeedActivity.class); intent.putExtra(EXTRA_USER_ID, userId); intent.putExtra(EXTRA_USER_NAME, userName); return intent; }
From source file:net.reichholf.dreamdroid.intents.IntentFactory.java
public static Intent getStreamServiceIntent(String ref, String title) { Intent intent = new Intent(Intent.ACTION_VIEW); String uriString = SimpleHttpClient.getInstance().buildServiceStreamUrl(ref, title); Log.i(DreamDroid.LOG_TAG, "Service-Streaming URL set to '" + uriString + "'"); intent.setDataAndType(Uri.parse(uriString), "video/*"); intent.putExtra("title", title); return intent; }
From source file:ch.fixme.status.Widget.java
public static void UpdateAllWidgets(final Context ctxt) { AppWidgetManager man = AppWidgetManager.getInstance(ctxt); int[] ids = man.getAppWidgetIds(new ComponentName(ctxt, Widget.class)); Intent ui = new Intent(); ui.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); ui.putExtra(Widget.WIDGET_IDS, ids); ui.putExtra(Widget.WIDGET_FORCE, true); ctxt.sendBroadcast(ui);//from w w w . j av a2 s .c om }
From source file:st.brothas.mtgoxwidget.MtGoxWidgetProvider.java
static void updateAppWidget(final Context context, AppWidgetManager appWidgetManager, int appWidgetId) { WidgetPreferences preferences = MtGoxPreferencesActivity.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;/*w ww. j a v a2 s . c o m*/ } RemoteViews 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()); MtGoxDataOpenHelper dbHelper = new MtGoxDataOpenHelper(context); MtGoxTickerData prevData = dbHelper.getLastTickerData(preferences); MtGoxTickerData newData; JSONObject latestQuoteJSON = getLatestQuoteJSON(preferences); if (latestQuoteJSON != null) { newData = preferences.getRateService().parseJSON(latestQuoteJSON); 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:com.jaguarlandrover.auto.remote.vehicleentry.RviService.java
static void sendNotification(Context ctx, String action, String... extras) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); NotificationManager nm = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE); boolean fire = prefs.getBoolean("pref_fire_notifications", true); if (!fire)/* ww w. j a v a 2 s . co m*/ return; NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx).setSmallIcon(R.drawable.rvi_not) .setAutoCancel(true).setContentTitle(ctx.getResources().getString(R.string.app_name)) .setContentText(action); Intent targetIntent = new Intent(ctx, LockActivity.class); int j = 0; for (String ex : extras) { targetIntent.putExtra("_extra" + (++j), ex); targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); } PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(contentIntent); nm.notify(0, builder.build()); }
From source file:cgeo.geocaching.AboutActivity.java
public static void showChangeLog(final Activity fromActivity) { final Intent intent = new Intent(fromActivity, AboutActivity.class); intent.putExtra(EXTRA_ABOUT_STARTPAGE, Page.CHANGELOG.ordinal()); fromActivity.startActivity(intent);//from w ww .j a va 2 s. c o m }