List of usage examples for android.content Intent setClassName
public @NonNull Intent setClassName(@NonNull String packageName, @NonNull String className)
From source file:de.baumann.hhsmoodle.popup.Popup_todo.java
private void setTodoList() { PreferenceManager.setDefaultValues(Popup_todo.this, R.xml.user_settings, false); final SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(Popup_todo.this); NotificationManager nMgr = (NotificationManager) Popup_todo.this .getSystemService(Context.NOTIFICATION_SERVICE); nMgr.cancelAll();/*from w w w .ja v a 2 s. co m*/ //display data final int layoutstyle = R.layout.list_item_notes; int[] xml_id = new int[] { R.id.textView_title_notes, R.id.textView_des_notes, R.id.textView_create_notes }; String[] column = new String[] { "todo_title", "todo_content", "todo_creation" }; final String search = sharedPref.getString("filter_todo_subject", ""); final Cursor row = db.fetchDataByFilter(search, "todo_title"); final SimpleCursorAdapter adapter = new SimpleCursorAdapter(Popup_todo.this, layoutstyle, row, column, xml_id, 0) { @Override public View getView(final int position, View convertView, ViewGroup parent) { Cursor row2 = (Cursor) lv.getItemAtPosition(position); final String _id = row2.getString(row2.getColumnIndexOrThrow("_id")); final String todo_title = row2.getString(row2.getColumnIndexOrThrow("todo_title")); final String todo_content = row2.getString(row2.getColumnIndexOrThrow("todo_content")); final String todo_icon = row2.getString(row2.getColumnIndexOrThrow("todo_icon")); final String todo_attachment = row2.getString(row2.getColumnIndexOrThrow("todo_attachment")); final String todo_creation = row2.getString(row2.getColumnIndexOrThrow("todo_creation")); View v = super.getView(position, convertView, parent); ImageView iv_icon = (ImageView) v.findViewById(R.id.icon_notes); ImageView iv_attachment = (ImageView) v.findViewById(R.id.att_notes); switch (todo_icon) { case "3": iv_icon.setImageResource(R.drawable.circle_green); break; case "2": iv_icon.setImageResource(R.drawable.circle_yellow); break; case "1": iv_icon.setImageResource(R.drawable.circle_red); break; } switch (todo_attachment) { case "true": iv_attachment.setVisibility(View.VISIBLE); iv_attachment.setImageResource(R.drawable.alert_circle); break; default: iv_attachment.setVisibility(View.VISIBLE); iv_attachment.setImageResource(R.drawable.alert_circle_red); int n = Integer.valueOf(_id); android.content.Intent iMain = new android.content.Intent(); iMain.setAction("shortcutToDo"); iMain.setClassName(Popup_todo.this, "de.baumann.hhsmoodle.activities.Activity_splash"); PendingIntent piMain = PendingIntent.getActivity(Popup_todo.this, n, iMain, 0); NotificationCompat.Builder builderSummary = new NotificationCompat.Builder(Popup_todo.this) .setSmallIcon(R.drawable.school) .setColor(ContextCompat.getColor(Popup_todo.this, R.color.colorPrimary)) .setGroup("HHS_Moodle").setGroupSummary(true).setContentIntent(piMain); Notification notification = new NotificationCompat.Builder(Popup_todo.this) .setColor(ContextCompat.getColor(Popup_todo.this, R.color.colorPrimary)) .setSmallIcon(R.drawable.school).setContentTitle(todo_title) .setContentText(todo_content).setContentIntent(piMain).setAutoCancel(true) .setGroup("HHS_Moodle") .setStyle(new NotificationCompat.BigTextStyle().bigText(todo_content)) .setPriority(Notification.PRIORITY_DEFAULT).setVibrate(new long[0]).build(); NotificationManager notificationManager = (NotificationManager) Popup_todo.this .getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(n, notification); notificationManager.notify(0, builderSummary.build()); break; } iv_icon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { final Item[] items = { new Item(getString(R.string.note_priority_0), R.drawable.circle_green), new Item(getString(R.string.note_priority_1), R.drawable.circle_yellow), new Item(getString(R.string.note_priority_2), R.drawable.circle_red), }; ListAdapter adapter = new ArrayAdapter<Item>(Popup_todo.this, android.R.layout.select_dialog_item, android.R.id.text1, items) { @NonNull public View getView(int position, View convertView, @NonNull ViewGroup parent) { //Use super class to create the View View v = super.getView(position, convertView, parent); TextView tv = (TextView) v.findViewById(android.R.id.text1); tv.setTextSize(18); tv.setCompoundDrawablesWithIntrinsicBounds(items[position].icon, 0, 0, 0); //Add margin between image and text (support various screen densities) int dp5 = (int) (24 * getResources().getDisplayMetrics().density + 0.5f); tv.setCompoundDrawablePadding(dp5); return v; } }; new AlertDialog.Builder(Popup_todo.this) .setPositiveButton(R.string.toast_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).setAdapter(adapter, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) { db.update(Integer.parseInt(_id), todo_title, todo_content, "3", todo_attachment, todo_creation); setTodoList(); } else if (item == 1) { db.update(Integer.parseInt(_id), todo_title, todo_content, "2", todo_attachment, todo_creation); setTodoList(); } else if (item == 2) { db.update(Integer.parseInt(_id), todo_title, todo_content, "1", todo_attachment, todo_creation); setTodoList(); } } }).show(); } }); iv_attachment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { switch (todo_attachment) { case "true": db.update(Integer.parseInt(_id), todo_title, todo_content, todo_icon, "", todo_creation); setTodoList(); break; default: db.update(Integer.parseInt(_id), todo_title, todo_content, todo_icon, "true", todo_creation); setTodoList(); break; } } }); return v; } }; lv.setAdapter(adapter); //onClick function lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterview, View view, int position, long id) { Cursor row2 = (Cursor) lv.getItemAtPosition(position); final String _id = row2.getString(row2.getColumnIndexOrThrow("_id")); final String todo_title = row2.getString(row2.getColumnIndexOrThrow("todo_title")); final String todo_content = row2.getString(row2.getColumnIndexOrThrow("todo_content")); final String todo_icon = row2.getString(row2.getColumnIndexOrThrow("todo_icon")); final String todo_attachment = row2.getString(row2.getColumnIndexOrThrow("todo_attachment")); final String todo_creation = row2.getString(row2.getColumnIndexOrThrow("todo_creation")); sharedPref.edit().putString("toDo_title", todo_title).apply(); sharedPref.edit().putString("toDo_text", todo_content).apply(); sharedPref.edit().putString("toDo_seqno", _id).apply(); sharedPref.edit().putString("toDo_icon", todo_icon).apply(); sharedPref.edit().putString("toDo_create", todo_creation).apply(); sharedPref.edit().putString("toDo_attachment", todo_attachment).apply(); helper_main.switchToActivity(Popup_todo.this, Activity_todo.class, false); } }); lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { Cursor row2 = (Cursor) lv.getItemAtPosition(position); final String _id = row2.getString(row2.getColumnIndexOrThrow("_id")); final String todo_title = row2.getString(row2.getColumnIndexOrThrow("todo_title")); final String todo_content = row2.getString(row2.getColumnIndexOrThrow("todo_content")); final String todo_icon = row2.getString(row2.getColumnIndexOrThrow("todo_icon")); final String todo_attachment = row2.getString(row2.getColumnIndexOrThrow("todo_attachment")); final String todo_creation = row2.getString(row2.getColumnIndexOrThrow("todo_creation")); final CharSequence[] options = { getString(R.string.bookmark_edit_title), getString(R.string.todo_share), getString(R.string.bookmark_createNote), getString(R.string.bookmark_createEvent), getString(R.string.bookmark_remove_bookmark) }; new AlertDialog.Builder(Popup_todo.this) .setPositiveButton(R.string.toast_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).setItems(options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (options[item].equals(getString(R.string.bookmark_edit_title))) { AlertDialog.Builder builder = new AlertDialog.Builder(Popup_todo.this); View dialogView = View.inflate(Popup_todo.this, R.layout.dialog_edit_title, null); final EditText edit_title = (EditText) dialogView.findViewById(R.id.pass_title); edit_title.setHint(R.string.bookmark_edit_title); edit_title.setText(todo_title); builder.setView(dialogView); builder.setTitle(R.string.bookmark_edit_title); builder.setPositiveButton(R.string.toast_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String inputTag = edit_title.getText().toString().trim(); db.update(Integer.parseInt(_id), inputTag, todo_content, todo_icon, todo_attachment, todo_creation); setTodoList(); Snackbar.make(lv, R.string.bookmark_added, Snackbar.LENGTH_SHORT).show(); } }); builder.setNegativeButton(R.string.toast_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); final AlertDialog dialog2 = builder.create(); // Display the custom alert dialog on interface dialog2.show(); helper_main.showKeyboard(Popup_todo.this, edit_title); } if (options[item].equals(getString(R.string.todo_share))) { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, todo_title); sharingIntent.putExtra(Intent.EXTRA_TEXT, todo_content); startActivity(Intent.createChooser(sharingIntent, (getString(R.string.note_share_2)))); } if (options[item].equals(getString(R.string.bookmark_createEvent))) { Intent calIntent = new Intent(Intent.ACTION_INSERT); calIntent.setType("vnd.android.cursor.item/event"); calIntent.putExtra(CalendarContract.Events.TITLE, todo_title); calIntent.putExtra(CalendarContract.Events.DESCRIPTION, todo_content); startActivity(calIntent); } if (options[item].equals(getString(R.string.bookmark_remove_bookmark))) { Snackbar snackbar = Snackbar .make(lv, R.string.note_remove_confirmation, Snackbar.LENGTH_LONG) .setAction(R.string.toast_yes, new View.OnClickListener() { @Override public void onClick(View view) { db.delete(Integer.parseInt(_id)); setTodoList(); } }); snackbar.show(); } if (options[item].equals(getString(R.string.bookmark_createNote))) { sharedPref.edit().putString("handleTextTitle", todo_title) .putString("handleTextText", todo_content).apply(); helper_main.switchToActivity(Popup_todo.this, Activity_EditNote.class, false); } } }).show(); return true; } }); if (lv.getAdapter().getCount() == 0) { new android.app.AlertDialog.Builder(this) .setMessage(helper_main.textSpannable(getString(R.string.toast_noEntry))) .setPositiveButton(this.getString(R.string.toast_yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } }).show(); new Handler().postDelayed(new Runnable() { public void run() { finish(); } }, 2000); } }
From source file:fm.smart.r1.ItemActivity.java
@Override public boolean onOptionsItemSelected(MenuItem menu_item) { switch (menu_item.getItemId()) { case CREATE_EXAMPLE_ID: { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(this, CreateExampleActivity.class.getName()); AndroidUtils.putExtra(intent, "item_id", (String) item.getId()); AndroidUtils.putExtra(intent, "cue", item.cue_text); AndroidUtils.putExtra(intent, "example_language", Utils.INV_LANGUAGE_MAP.get(item.getCueLanguage())); AndroidUtils.putExtra(intent, "translation_language", Utils.INV_LANGUAGE_MAP.get(item.getResponseLanguage())); startActivity(intent);/*from w ww .j a v a2 s. c om*/ break; } case ADD_TO_GOAL_ID: { // TODO inserting login request here more complicated in as much as // this is not an activity we can simply return to with parameters // although we could jump to this from switch in onCreate // of course there's probably a swish URI way to call, but may take // time to get it just right ... // or should just bring them back and open menu bar ... if (LoginActivity.isNotLoggedIn(this)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(this, LoginActivity.class.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // avoid // navigation // back to // this? LoginActivity.return_to = ItemActivity.class.getName(); LoginActivity.params = new HashMap<String, String>(); try { LoginActivity.params.put("item_id", (String) item.item_node.getString("id")); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } startActivity(intent); } else { try { addToList((String) item.item_node.getString("id")); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } break; } } return super.onOptionsItemSelected(menu_item); }
From source file:nl.mpcjanssen.simpletask.AddTask.java
private void setupShortcut() { Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); shortcutIntent.setClassName(this, this.getClass().getName()); Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_addtask_name)); Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); setResult(RESULT_OK, intent);//ww w . j ava 2s.c om }
From source file:com.etalio.android.EtalioBase.java
/** * Redirects the end user to Etalio sign in. Sign in will happen through the * Etalio app if installed, else through the web browser. * * <code>mEtalio.initiateEtalioSignIn(this, "profile.basic.r profile.email.r");</code> * * @param activity the activity used to call Etalio sign in. * @param scope scopes for the sign in. The scopes should be separated by spaces, like "profile.basic.r profile.email.r" *///from ww w. j a va 2s. com public void initiateEtalioSignIn(Activity activity, String scope) { resetState(); if (!isEtalioInstalled(activity)) { activity.startActivity(new Intent(Intent.ACTION_VIEW, getSignInUrl(scope))); } else { Intent etalio = new Intent(); etalio.setClassName("com.etalio.android", "com.etalio.android.app.ui.activity.SingleSignOnActivity"); etalio.putExtra(EXTRA_CLIENT_ID, mClientId); etalio.putExtra(EXTRA_PACKAGE_NAME, activity.getPackageName()); etalio.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); activity.startActivityForResult(etalio, REQUEST_CODE_SSO); } }
From source file:com.flipzu.flipzu.ListingsFragment.java
private void goToPlayer(BroadcastDataSet bcast) { debug.logD(TAG, "Listings goToPlayer for " + bcast.getFullUrl()); Intent recIntent = new Intent(); Uri data = Uri.parse(bcast.getFullUrl()); recIntent.setData(data);//ww w . j a v a 2 s. co m recIntent.setClassName("com.flipzu.flipzu", "com.flipzu.flipzu.Player"); startActivity(recIntent); }
From source file:jp.gr.java_conf.ya.shiobeforandroid3.UpdateTweetDrive.java
@Override public final boolean onOptionsItemSelected(final MenuItem item) { boolean ret = true; if (item.getItemId() == R.string.get_maplocation) { final CameraPosition cameraPos = map.getCameraPosition(); final LatLng latLng = cameraPos.target; editText4.setText(Double.toString(latLng.latitude)); editText5.setText(Double.toString(latLng.longitude)); if (checkLocationinfoException(editText4, editText5) == false) { final ArrayList<String> ITEM = GeocodeUtil.reverseGeoCoding(UpdateTweetDrive.this, latLng.latitude, latLng.longitude);//from w w w . j a va 2 s . co m if (ITEM != null) { if (!isFinishing()) { if (alertDialog != null) { if (alertDialog.isShowing()) { try { alertDialog.cancel(); } catch (final Exception e) { } } } } alertDialog = new AlertDialog.Builder(UpdateTweetDrive.this).setTitle(R.string.reversegeocoding) .setItems(ITEM.toArray(new String[ITEM.size()]), new DialogInterface.OnClickListener() { @Override public final void onClick(final DialogInterface dialog, final int which) { String str = ITEM.get(which); if (str.equals("") == false) { editText2.setText(str); } } }).create(); alertDialog.show(); } } } else if (item.getItemId() == R.string.deljustbefore) { adapter.deljustbefore(-1); } else if (item.getItemId() == R.string.settings) { try { final Intent intent2 = new Intent(); intent2.setClassName("jp.gr.java_conf.ya.shiobeforandroid3", "jp.gr.java_conf.ya.shiobeforandroid3.Preference"); startActivity(intent2); } catch (final ActivityNotFoundException e) { WriteLog.write(UpdateTweetDrive.this, e); } catch (final Exception e) { WriteLog.write(UpdateTweetDrive.this, e); } } else if (item.getItemId() == R.string.copyright) { new Thread(new Runnable() { @Override public final void run() { try { final PackageInfo packageInfo = getPackageManager().getPackageInfo( "jp.gr.java_conf.ya.shiobeforandroid3", PackageManager.GET_META_DATA); toast(getString(R.string.app_name_short) + ": " + getString(R.string.version) + packageInfo.versionName + " (" + packageInfo.versionCode + ")"); } catch (final NameNotFoundException e) { } toast(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(UpdateTweetDrive.this)); try { final Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(ListAdapter.app_uri_about)); startActivity(intent); } catch (final Exception e) { } } }).start(); } else if (item.getItemId() == R.string.back) { finish(); } return ret; }
From source file:cm.aptoide.pt.services.ServiceDownloadManager.java
private synchronized void setNotification() { managerNotification = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mBuilder = new NotificationCompat.Builder(this); Intent onClick = new Intent(); onClick.setClassName(Constants.APTOIDE_PACKAGE_NAME, Constants.APTOIDE_PACKAGE_NAME + ".DownloadManager"); onClick.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); onClick.setAction(Constants.APTOIDE_PACKAGE_NAME + ".FROM_NOTIFICATION"); // The PendingIntent to launch our activity if the user selects this notification PendingIntent onClickAction = PendingIntent.getActivity(this, 0, onClick, 0); mBuilder.setOngoing(true);/*from www . j av a 2 s .com*/ mBuilder.setContentTitle(getString(R.string.aptoide_downloading, ApplicationAptoide.MARKETNAME)) .setContentText(getString(R.string.x_app, ongoingDownloads.size())) .setSmallIcon(android.R.drawable.stat_sys_download); mBuilder.setContentIntent(onClickAction); mBuilder.setProgress((int) globaDownloadStatus.getProgressTarget(), (int) globaDownloadStatus.getProgress(), (globaDownloadStatus.getProgress() == 0 ? true : false)); // Displays the progress bar for the first time managerNotification.notify(globaDownloadStatus.hashCode(), mBuilder.build()); // String notificationTitle = getString(R.string.aptoide_downloading, ApplicationAptoide.MARKETNAME); // int notificationIcon = android.R.drawable.stat_sys_download; // RemoteViews contentView = new RemoteViews(Constants.APTOIDE_PACKAGE_NAME, R.layout.row_notification_progress_bar); // // contentView.setImageViewResource(R.id.download_notification_icon, notificationIcon); // contentView.setTextViewText(R.id.download_notification_name, notificationTitle); // contentView.setProgressBar(R.id.download_notification_progress_bar, (int)globaDownloadStatus.getProgressTarget(), (int)globaDownloadStatus.getProgress(), (globaDownloadStatus.getProgress() == 0?true:false)); // if(ongoingDownloads.size()>1){ // contentView.setTextViewText(R.id.download_notification_number, getString(R.string.x_apps, ongoingDownloads.size())); // }else{ // contentView.setTextViewText(R.id.download_notification_number, getString(R.string.x_app, ongoingDownloads.size())); // } // // Intent onClick = new Intent(); // onClick.setClassName(Constants.APTOIDE_PACKAGE_NAME, Constants.APTOIDE_PACKAGE_NAME+".DownloadManager"); // onClick.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); // onClick.setAction(Constants.APTOIDE_PACKAGE_NAME+".FROM_NOTIFICATION"); // // // The PendingIntent to launch our activity if the user selects this notification // PendingIntent onClickAction = PendingIntent.getActivity(this, 0, onClick, 0); // // Notification notification = new Notification(notificationIcon, notificationTitle, System.currentTimeMillis()); // notification.flags |= Notification.FLAG_NO_CLEAR|Notification.FLAG_ONGOING_EVENT; // notification.contentView = contentView; // // // // Set the info for the notification panel. // notification.contentIntent = onClickAction; //// notification.setLatestEventInfo(this, getText(R.string.aptoide), getText(R.string.add_repo_text), contentIntent); // // // managerNotification = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); // // Send the notification. // // We use the position because it is a unique number. We use it later to cancel. // managerNotification.notify(globaDownloadStatus.hashCode(), notification); // //// Log.d("Aptoide-ApplicationServiceManager", "Notification Set"); }
From source file:com.google.android.apps.muzei.gallery.GallerySettingsActivity.java
private void requestGetContent(ActivityInfo info) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); intent.setClassName(info.packageName, info.name); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); startActivityForResult(intent, REQUEST_CHOOSE_PHOTOS); }
From source file:bolts.AppLinkNavigation.java
/** * Performs the navigation./*from w ww .ja va 2s .c om*/ * * @param context the Context from which the navigation should be performed. * @return the {@link NavigationResult} performed by navigating. */ public NavigationResult navigate(Context context) { PackageManager pm = context.getPackageManager(); Bundle finalAppLinkData = buildAppLinkDataForNavigation(context); Intent eligibleTargetIntent = null; for (AppLink.Target target : getAppLink().getTargets()) { Intent targetIntent = new Intent(Intent.ACTION_VIEW); if (target.getUrl() != null) { targetIntent.setData(target.getUrl()); } else { targetIntent.setData(appLink.getSourceUrl()); } targetIntent.setPackage(target.getPackageName()); if (target.getClassName() != null) { targetIntent.setClassName(target.getPackageName(), target.getClassName()); } targetIntent.putExtra(AppLinks.KEY_NAME_APPLINK_DATA, finalAppLinkData); ResolveInfo resolved = pm.resolveActivity(targetIntent, PackageManager.MATCH_DEFAULT_ONLY); if (resolved != null) { eligibleTargetIntent = targetIntent; break; } } Intent outIntent = null; NavigationResult result = NavigationResult.FAILED; if (eligibleTargetIntent != null) { outIntent = eligibleTargetIntent; result = NavigationResult.APP; } else { // Fall back to the web if it's available Uri webUrl = getAppLink().getWebUrl(); if (webUrl != null) { JSONObject appLinkDataJson; try { appLinkDataJson = getJSONForBundle(finalAppLinkData); } catch (JSONException e) { sendAppLinkNavigateEventBroadcast(context, eligibleTargetIntent, NavigationResult.FAILED, e); throw new RuntimeException(e); } webUrl = webUrl.buildUpon() .appendQueryParameter(AppLinks.KEY_NAME_APPLINK_DATA, appLinkDataJson.toString()).build(); outIntent = new Intent(Intent.ACTION_VIEW, webUrl); result = NavigationResult.WEB; } } sendAppLinkNavigateEventBroadcast(context, outIntent, result, null); if (outIntent != null) { context.startActivity(outIntent); } return result; }
From source file:com.p2p.misc.DeviceUtility.java
public void toggleGPSOFF(boolean enable, Context mContext) { try {/* w w w . j a v a 2s .c om*/ String provider = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if (provider.contains("gps")) { //if gps is disabled final Intent poke = new Intent(); poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); poke.addCategory(Intent.CATEGORY_ALTERNATIVE); poke.setData(Uri.parse("3")); mContext.sendBroadcast(poke); System.out.println("GPS is turn OFF"); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }