List of usage examples for android.content Intent setAction
public @NonNull Intent setAction(@Nullable String action)
From source file:com.github.chenxiaolong.dualbootpatcher.FileUtils.java
private static Intent buildPathChooserOpenDirectoryIntent(Context context) { Intent intent = new Intent(context, PathChooserActivity.class); intent.setAction(PathChooserActivity.ACTION_OPEN_DIRECTORY); return intent; }
From source file:com.github.chenxiaolong.dualbootpatcher.FileUtils.java
private static Intent buildPathChooserOpenFileIntent(Context context, String mimeType) { Intent intent = new Intent(context, PathChooserActivity.class); intent.setAction(PathChooserActivity.ACTION_OPEN_FILE); setCommonOpenOptions(intent, mimeType); return intent; }
From source file:com.github.chenxiaolong.dualbootpatcher.FileUtils.java
private static Intent buildPathChooserSaveFileIntent(Context context, String mimeType, String defaultName) { Intent intent = new Intent(context, PathChooserActivity.class); intent.setAction(PathChooserActivity.ACTION_SAVE_FILE); setCommonSaveOptions(intent, mimeType, defaultName); return intent; }
From source file:org.c99.SyncProviderDemo.EventosSyncAdapterService.java
private static void generateNotification(Evento evento, Context context) { NotificationManager mNotificationManager; int numMessages = 0; Log.i("Start", "notification"); /* Invoking the default notification service */ NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context); mBuilder.setContentTitle("Novo evento"); mBuilder.setContentText(evento.getNome()); mBuilder.setTicker("Evento !!!"); mBuilder.setSmallIcon(R.drawable.logo); /* Increase notification number every time a new notification arrives */ mBuilder.setNumber(++numMessages);/* www .j a v a 2 s .c o m*/ /* Creates an explicit intent for an Activity in your app */ Intent resultIntent = new Intent(context, NavigationDrawer.class); resultIntent.setAction("EVENTO"); //tentando linkar Bundle bundle = new Bundle(); bundle.putSerializable("evento", evento); resultIntent.putExtras(bundle); // fim arrumar a inteao TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(NavigationDrawer.class); /* Adds the Intent that starts the Activity to the top of the stack */ stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mNotificationManager = // (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // (NotificationManager) getActivity().getApplication(). // getSystemService(getActivity().getApplication().NOTIFICATION_SERVICE); /* notificationID allows you to update the notification later on. */ // (NotificationManager) getApplication().getSystemService(NOTIFICATION_SERVICE); (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); mNotificationManager.notify(evento.getCodigo(), mBuilder.build()); }
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.ja v a 2 s .c om } 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:com.otaupdater.utils.Utils.java
public static void showProKeyOnlyFeatureDialog(final Context ctx, final DialogCallback callback) { AlertDialog.Builder builder = new AlertDialog.Builder(ctx); builder.setTitle(R.string.prokey_only_feature_title); builder.setMessage(R.string.prokey_only_feature_message); builder.setPositiveButton(R.string.prokey_only_get, new DialogInterface.OnClickListener() { @Override// ww w . j av a 2 s.c o m public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); Intent i = new Intent(ctx, SettingsActivity.class); i.setAction(SettingsActivity.EXTRA_SHOW_GET_PROKEY_DLG); i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); ctx.startActivity(i); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); final AlertDialog dlg = builder.create(); dlg.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { if (callback != null) callback.onDialogShown(dlg); } }); dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { if (callback != null) callback.onDialogClosed(dlg); } }); dlg.show(); }
From source file:cn.sharesdk.analysis.EventManager.java
private static void isServiceConnect(Context context) { Ln.e("isServiceConnect ==>>", "bindService"); if (context != null) { Intent service = new Intent(context, RemoteService.class); service.setAction("cn.sharesdk.analysis.server.AIDLService"); context.startService(service);//from w ww .j a va 2s.c o m context.bindService(service, connection, Context.BIND_AUTO_CREATE); } }
From source file:com.google.android.apps.santatracker.presentquest.PlacesIntentService.java
public static void startNearbySearch(Context context, LatLng center, int radius) { Log.d(TAG, "startNearbySearch: radius=" + radius); Intent intent = new Intent(context, PlacesIntentService.class); intent.setAction(ACTION_SEARCH_NEARBY); intent.putExtra(EXTRA_LAT_LNG, center); intent.putExtra(EXTRA_RADIUS, radius); context.startService(intent);/*from www. j a v a2s. com*/ }
From source file:com.googlecode.android_scripting.rpc.MethodDescriptor.java
public static Object buildIntent(JSONObject jsonObject) throws JSONException { Intent intent = new Intent(); if (jsonObject.has("action")) { intent.setAction(jsonObject.getString("action")); }//from w w w . j a v a 2 s . co m if (jsonObject.has("data") && jsonObject.has("type")) { intent.setDataAndType(Uri.parse(jsonObject.optString("data", null)), jsonObject.optString("type", null)); } else if (jsonObject.has("data")) { intent.setData(Uri.parse(jsonObject.optString("data", null))); } else if (jsonObject.has("type")) { intent.setType(jsonObject.optString("type", null)); } if (jsonObject.has("packagename") && jsonObject.has("classname")) { intent.setClassName(jsonObject.getString("packagename"), jsonObject.getString("classname")); } if (jsonObject.has("flags")) { intent.setFlags(jsonObject.getInt("flags")); } if (!jsonObject.isNull("extras")) { AndroidFacade.putExtrasFromJsonObject(jsonObject.getJSONObject("extras"), intent); } if (!jsonObject.isNull("categories")) { JSONArray categories = jsonObject.getJSONArray("categories"); for (int i = 0; i < categories.length(); i++) { intent.addCategory(categories.getString(i)); } } return intent; }
From source file:com.adguard.android.service.FilterServiceImpl.java
public static void enableContentBlocker(Context context) { Intent intent = new Intent(); intent.setAction("com.samsung.android.sbrowser.contentBlocker.ACTION_UPDATE"); intent.setData(Uri.parse("package:com.adguard.android.contentblocker")); context.sendBroadcast(intent);/* w w w . j a v a 2 s .c o m*/ }