List of usage examples for android.provider Settings ACTION_WIRELESS_SETTINGS
String ACTION_WIRELESS_SETTINGS
To view the source code for android.provider Settings ACTION_WIRELESS_SETTINGS.
Click Source Link
From source file:net.yolosec.upckeygen.ui.NetworkFragment.java
/** * Try to open wifi settings activity.//from w w w . j a v a 2 s . c o m * Tries to different actions. */ private void openWifiSettings() { Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); final PackageManager packageManager = getActivity().getPackageManager(); if (packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) { startActivity(intent); return; } intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); if (packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) { startActivity(intent); } }
From source file:com.pacoapp.paco.ui.FindExperimentsActivity.java
public void showNetworkConnectionActivity() { try {// w ww .j av a2 s . c om startActivityForResult(new Intent(Settings.ACTION_WIRELESS_SETTINGS), NetworkUtil.ENABLED_NETWORK); } catch (Exception e) { } }
From source file:org.ubicompforall.cityexplorer.CityExplorer.java
/** * Display a dialog that user has no Internet connection * Code from: http://osdir.com/ml/Android-Developers/2009-11/msg05044.html * @return //from www.ja v a 2s .c o m */ public static AlertDialog showNoConnectionDialog(final Context myContext, final String msg, final String cancelButtonStr, final Intent cancelIntent) { AlertDialog.Builder builder = new AlertDialog.Builder(myContext); builder.setCancelable(true); if (msg == "") { builder.setMessage(R.string.no_connection); } else { builder.setMessage(msg); } builder.setTitle(R.string.no_connection_title); builder.setPositiveButton(R.string.settings, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { myContext.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } }); String cancelText = cancelButtonStr; if (cancelText == "") { cancelText = myContext.getResources().getString(R.string.cancel); } builder.setNegativeButton(cancelText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (cancelIntent != null) { if (myContext instanceof Activity) { ((Activity) myContext).startActivityForResult(cancelIntent, CityExplorer.REQUEST_LOCATION); } else { debug(-1, "This is not an Activity!!"); } dialog.dismiss(); } return; } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { if (myContext == null) { debug(0, "OOOPS!"); } else { Toast.makeText(myContext, "CANCELLED!", Toast.LENGTH_LONG).show(); if (cancelIntent != null) { myContext.startActivity(cancelIntent); } } return; } }); DATACONNECTION_NOTIFIED = true; return builder.show(); }
From source file:activities.GatewayActivity.java
@Override public void onOKChooseOnlineSourceDialogButtonClick() { //enableSettings(Settings.ACTION_DATA_ROAMING_SETTINGS); try {//w w w .ja v a2s. co m enableSettings(Settings.ACTION_WIRELESS_SETTINGS); } catch (Exception e) { e.printStackTrace(); showToast(getString(R.string.toast_enable_wireless)); } }
From source file:com.support.android.designlibdemo.EditContactActivity.java
/** * Create a dialog that send user to NFC settings if NFC is off (and save * the dialog in {@link #mEnableNfc}). Alternatively the user can choos to * use the App in editor only mode or exit the App. *//*w w w.j a v a 2 s. c o m*/ private void createNfcEnableDialog() { mEnableNfc = new AlertDialog.Builder(this).setTitle(R.string.dialog_nfc_not_enabled_title) .setMessage(R.string.dialog_nfc_not_enabled).setIcon(android.R.drawable.ic_dialog_info) .setPositiveButton(R.string.action_nfc, new DialogInterface.OnClickListener() { @Override @SuppressLint("InlinedApi") public void onClick(DialogInterface dialog, int which) { // Goto NFC Settings. if (Build.VERSION.SDK_INT >= 16) { startActivity(new Intent(Settings.ACTION_NFC_SETTINGS)); } else { startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } } }).setNeutralButton(R.string.action_editor_only, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Only use Editor. } }).setNegativeButton(R.string.action_exit_app, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Exit the App. finish(); } }).create(); }
From source file:de.syss.MifareClassicTool.Activities.MainMenu.java
/** * Create a dialog that send user to NFC settings if NFC is off (and save * the dialog in {@link #mEnableNfc}). Alternatively the user can choos to * use the App in editor only mode or exit the App. */// w ww . jav a 2 s . c o m private void createNfcEnableDialog() { mEnableNfc = new AlertDialog.Builder(this).setTitle(R.string.dialog_nfc_not_enabled_title) .setMessage(R.string.dialog_nfc_not_enabled).setIcon(android.R.drawable.ic_dialog_info) .setPositiveButton(R.string.action_nfc, new DialogInterface.OnClickListener() { @Override @SuppressLint("InlinedApi") public void onClick(DialogInterface dialog, int which) { // Goto NFC Settings. if (Build.VERSION.SDK_INT >= 16) { startActivity(new Intent(Settings.ACTION_NFC_SETTINGS)); } else { startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } } }).setNeutralButton(R.string.action_editor_only, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Only use Editor. Common.setUseAsEditorOnly(true); } }).setNegativeButton(R.string.action_exit_app, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Exit the App. finish(); } }).create(); }
From source file:com.ranglerz.tlc.tlc.com.ranglerz.tlc.tlc.ReportAccident.ReportAccidentForm.java
protected void createNetErrorDialog() { if (isNetworkAvailable() == false) { android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder( this); builder.setMessage(/* ww w . j av a 2 s . c o m*/ "You need a network connection to use this application. Please turn on mobile network or Wi-Fi in Settings.") .setTitle("Unable to connect").setCancelable(false) .setPositiveButton("Settings", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent i = new Intent(Settings.ACTION_WIRELESS_SETTINGS); startActivity(i); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ReportAccidentForm.this.finish(); } }); android.support.v7.app.AlertDialog alert = builder.create(); alert.show(); } else { //remainging } }
From source file:com.stanleyidesis.quotograph.ui.activity.LWQActivateActivity.java
void presentNetworkRequiredDialog() { UIUtils.presentDialog(this, R.string.network_connection_required_title, R.string.network_connection_required_message, android.R.string.ok, R.string.network_connection_required_negative, null, new DialogInterface.OnClickListener() { @Override/*from w w w . j ava 2 s. c o m*/ public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); try { startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } catch (Exception e) { e.printStackTrace(); } } }); }
From source file:com.pacoapp.paco.ui.MyExperimentsActivity.java
private void showNetworkConnectionActivity() { startActivityForResult(new Intent(Settings.ACTION_WIRELESS_SETTINGS), NetworkUtil.ENABLED_NETWORK); }
From source file:com.company.millenium.iwannask.MainActivity.java
public static void showNoConnectionDialog(Context ctx1) { final Context ctx = ctx1; AlertDialog.Builder builder = new AlertDialog.Builder(ctx, R.style.AlertDialog); builder.setCancelable(true);/*from w ww. ja v a2 s. c o m*/ builder.setMessage(R.string.no_connection); builder.setTitle(R.string.no_connection_title); builder.setPositiveButton(R.string.settings_button_text, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { ctx.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } }); builder.setNegativeButton(R.string.cancel_button_text, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { return; } }); builder.show(); }