List of usage examples for android.app AlertDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:cm.aptoide.pt.MainActivity.java
private void showAddStoreCredentialsDialog(String string) { View credentialsDialogView = LayoutInflater.from(mContext).inflate(R.layout.dialog_add_pvt_store, null); AlertDialog credentialsDialog = new AlertDialog.Builder(mContext).setView(credentialsDialogView).create(); credentialsDialog.setTitle(getString(R.string.add_private_store) + " " + RepoUtils.split(string)); credentialsDialog.setButton(Dialog.BUTTON_NEUTRAL, getString(R.string.new_store), new AddStoreCredentialsListener(string, credentialsDialogView)); credentialsDialog.show();/* w w w .j a v a2 s.c o m*/ }
From source file:cm.aptoide.pt.MainActivity.java
private void showUpdateStoreCredentialsDialog(String string) { View credentialsDialogView = LayoutInflater.from(mContext).inflate(R.layout.dialog_add_pvt_store, null); AlertDialog credentialsDialog = new AlertDialog.Builder(mContext).setView(credentialsDialogView).create(); credentialsDialog.setTitle(getString(R.string.add_private_store) + " " + RepoUtils.split(string)); credentialsDialog.setButton(Dialog.BUTTON_NEUTRAL, getString(R.string.new_store), new UpdateStoreCredentialsListener(string, credentialsDialogView)); credentialsDialog.show();//from w ww .ja v a 2 s. co m }
From source file:com.haibison.android.anhuu.FragmentFiles.java
/** * Confirms user to create new directory. *///from ww w. jav a 2 s. co m private void showNewDirectoryCreationDialog() { final AlertDialog dialog = Dlg.newAlertDlg(getActivity()); View view = getLayoutInflater(null).inflate(R.layout.anhuu_f5be488d_simple_text_input_view, null); final EditText textFile = (EditText) view.findViewById(R.id.anhuu_f5be488d_text1); textFile.setHint(R.string.anhuu_f5be488d_hint_folder_name); textFile.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { UI.showSoftKeyboard(v, false); dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick(); return true; } return false; } }); dialog.setView(view); dialog.setTitle(R.string.anhuu_f5be488d_cmd_new_folder); dialog.setIcon(android.R.drawable.ic_menu_add); dialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final String name = textFile.getText().toString().trim(); if (!FileUtils.isFilenameValid(name)) { Dlg.toast(getActivity(), getString(R.string.anhuu_f5be488d_pmsg_filename_is_invalid, name), Dlg.LENGTH_SHORT); return; } new LoadingDialog<Void, Void, Uri>(getActivity(), false) { @Override protected Uri doInBackground(Void... params) { return getActivity().getContentResolver().insert( BaseFile.genContentUriBase(getCurrentLocation().getAuthority()).buildUpon() .appendPath(getCurrentLocation().getLastPathSegment()) .appendQueryParameter(BaseFile.PARAM_NAME, name) .appendQueryParameter(BaseFile.PARAM_FILE_TYPE, Integer.toString(BaseFile.FILE_TYPE_DIRECTORY)) .build(), null); }// doInBackground() @Override protected void onPostExecute(Uri result) { super.onPostExecute(result); if (result != null) { Dlg.toast(getActivity(), getString(R.string.anhuu_f5be488d_msg_done), Dlg.LENGTH_SHORT); } else Dlg.toast(getActivity(), getString(R.string.anhuu_f5be488d_pmsg_cannot_create_folder, name), Dlg.LENGTH_SHORT); }// onPostExecute() }.execute(); }// onClick() }); dialog.show(); UI.showSoftKeyboard(textFile, true); final Button buttonOk = dialog.getButton(DialogInterface.BUTTON_POSITIVE); buttonOk.setEnabled(false); textFile.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { /* * Do nothing. */ }// onTextChanged() @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { /* * Do nothing. */ }// beforeTextChanged() @Override public void afterTextChanged(Editable s) { buttonOk.setEnabled(FileUtils.isFilenameValid(s.toString().trim())); }// afterTextChanged() }); }
From source file:cm.aptoide.pt.MainActivity.java
public void showAbout() { View aboutView = LayoutInflater.from(this).inflate(R.layout.dialog_about, null); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this).setView(aboutView); final AlertDialog aboutDialog = dialogBuilder.create(); aboutDialog.setIcon(android.R.drawable.ic_menu_help); aboutDialog.setTitle(getString(R.string.about)); aboutDialog.setCancelable(true);//w w w . java2 s. c om WindowManager.LayoutParams params = aboutDialog.getWindow().getAttributes(); params.width = WindowManager.LayoutParams.MATCH_PARENT; aboutDialog.getWindow().setAttributes(params); aboutDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.btn_chlog), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Uri uri = Uri.parse(getString(R.string.change_log_url)); startActivity(new Intent(Intent.ACTION_VIEW, uri)); } }); aboutDialog.show(); }
From source file:cm.aptoide.pt.MainActivity.java
public void showFollow() { View socialNetworksView = LayoutInflater.from(this).inflate(R.layout.dialog_social_networks, null); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this).setView(socialNetworksView); final AlertDialog socialDialog = dialogBuilder.create(); socialDialog.setIcon(android.R.drawable.ic_menu_share); socialDialog.setTitle(getString(R.string.social_networks)); socialDialog.setCancelable(true);/*from w ww . jav a 2 s . co m*/ Button facebookButton = (Button) socialNetworksView.findViewById(R.id.find_facebook); facebookButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (isAppInstalled("com.facebook.katana")) { Intent sharingIntent; try { getPackageManager().getPackageInfo("com.facebook.katana", 0); sharingIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/225295240870860")); startActivity(sharingIntent); } catch (NameNotFoundException e) { e.printStackTrace(); } } else { Intent intent = new Intent(mContext, WebViewFacebook.class); startActivity(intent); } } }); Button twitterButton = (Button) socialNetworksView.findViewById(R.id.follow_twitter); twitterButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (isAppInstalled("com.twitter.android")) { String url = "http://www.twitter.com/aptoide"; Intent twitterIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(twitterIntent); } else { Intent intent = new Intent(mContext, WebViewTwitter.class); startActivity(intent); } } }); socialDialog.show(); }
From source file:cm.aptoide.pt.MainActivity.java
private void displayOptionsDialog() { final SharedPreferences sPref = PreferenceManager.getDefaultSharedPreferences(this); final Editor editor = sPref.edit(); View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_order_popup, null); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(mContext).setView(view); final AlertDialog orderDialog = dialogBuilder.create(); orderDialog.setIcon(android.R.drawable.ic_menu_sort_by_size); orderDialog.setTitle(getString(R.string.menu_display_options)); orderDialog.setCancelable(true);/*from w w w .j a v a 2s.co m*/ final RadioButton ord_rct = (RadioButton) view.findViewById(R.id.org_rct); final RadioButton ord_abc = (RadioButton) view.findViewById(R.id.org_abc); final RadioButton ord_rat = (RadioButton) view.findViewById(R.id.org_rat); final RadioButton ord_dwn = (RadioButton) view.findViewById(R.id.org_dwn); final RadioButton ord_price = (RadioButton) view.findViewById(R.id.org_price); final RadioButton btn1 = (RadioButton) view.findViewById(R.id.shw_ct); final RadioButton btn2 = (RadioButton) view.findViewById(R.id.shw_all); final ToggleButton adult = (ToggleButton) view.findViewById(R.id.adultcontent_toggle); orderDialog.setButton(Dialog.BUTTON_NEUTRAL, "Ok", new Dialog.OnClickListener() { boolean pop_change = false; private boolean pop_change_category = false; public void onClick(DialogInterface dialog, int which) { if (ord_rct.isChecked()) { pop_change = true; order = Order.DATE; } else if (ord_abc.isChecked()) { pop_change = true; order = Order.NAME; } else if (ord_rat.isChecked()) { pop_change = true; order = Order.RATING; } else if (ord_dwn.isChecked()) { pop_change = true; order = Order.DOWNLOADS; } else if (ord_price.isChecked()) { pop_change = true; order = Order.PRICE; } if (btn1.isChecked()) { pop_change = true; pop_change_category = true; editor.putBoolean("orderByCategory", true); } else if (btn2.isChecked()) { pop_change = true; pop_change_category = true; editor.putBoolean("orderByCategory", false); } if (adult.isChecked()) { pop_change = true; editor.putBoolean("matureChkBox", false); } else { editor.putBoolean("matureChkBox", true); } if (pop_change) { editor.putInt("order_list", order.ordinal()); editor.commit(); if (pop_change_category) { if (!depth.equals(ListDepth.CATEGORY1) && !depth.equals(ListDepth.STORES)) { if (depth.equals(ListDepth.APPLICATIONS)) { removeLastBreadCrumb(); } removeLastBreadCrumb(); depth = ListDepth.CATEGORY1; } } redrawAll(); refreshAvailableList(true); } } }); if (sPref.getBoolean("orderByCategory", false)) { btn1.setChecked(true); } else { btn2.setChecked(true); } if (!ApplicationAptoide.MATURECONTENTSWITCH) { adult.setVisibility(View.GONE); view.findViewById(R.id.dialog_adult_content_label).setVisibility(View.GONE); } adult.setChecked(!sPref.getBoolean("matureChkBox", false)); // adult.setOnCheckedChangeListener(adultCheckedListener); switch (order) { case DATE: ord_rct.setChecked(true); break; case DOWNLOADS: ord_dwn.setChecked(true); break; case NAME: ord_abc.setChecked(true); break; case RATING: ord_rat.setChecked(true); break; case PRICE: ord_price.setChecked(true); break; default: break; } orderDialog.show(); }
From source file:cm.aptoide.pt.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { AptoideThemePicker.setAptoideTheme(this); super.onCreate(savedInstanceState); serviceDownloadManagerIntent = new Intent(this, ServiceDownloadManager.class); startService(serviceDownloadManagerIntent); mContext = this; File sdcard_file = new File(SDCARD); if (!sdcard_file.exists() || !sdcard_file.canWrite()) { View simpleView = LayoutInflater.from(mContext).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(mContext).setView(simpleView); final AlertDialog noSDDialog = dialogBuilder.create(); noSDDialog.setTitle(getText(R.string.remote_in_noSD_title)); noSDDialog.setIcon(android.R.drawable.ic_dialog_alert); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText(getText(R.string.remote_in_noSD)); noSDDialog.setCancelable(false); noSDDialog.setButton(Dialog.BUTTON_NEUTRAL, getString(android.R.string.ok), new Dialog.OnClickListener() { @Override/* ww w.j a v a 2 s.c o m*/ public void onClick(DialogInterface arg0, int arg1) { finish(); } }); noSDDialog.show(); } else { StatFs stat = new StatFs(sdcard_file.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); long availableBlocks = stat.getAvailableBlocks(); long total = (blockSize * totalBlocks) / 1024 / 1024; long avail = (blockSize * availableBlocks) / 1024 / 1024; Log.d("Aptoide", "* * * * * * * * * *"); Log.d("Aptoide", "Total: " + total + " Mb"); Log.d("Aptoide", "Available: " + avail + " Mb"); if (avail < 10) { Log.d("Aptoide", "No space left on SDCARD..."); Log.d("Aptoide", "* * * * * * * * * *"); View simpleView = LayoutInflater.from(this).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(this).setView(simpleView); final AlertDialog noSpaceDialog = dialogBuilder.create(); noSpaceDialog.setIcon(android.R.drawable.ic_dialog_alert); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText(getText(R.string.remote_in_noSDspace)); noSpaceDialog.setButton(Dialog.BUTTON_NEUTRAL, getText(android.R.string.ok), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { finish(); } }); noSpaceDialog.show(); } else { SharedPreferences sPref = PreferenceManager.getDefaultSharedPreferences(mContext); editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); if (!sPref.contains("matureChkBox")) { editor.putBoolean("matureChkBox", ApplicationAptoide.MATURECONTENTSWITCHVALUE); SharedPreferences sPrefOld = getSharedPreferences("aptoide_prefs", MODE_PRIVATE); if (sPrefOld.getString("app_rating", "none").equals("Mature")) { editor.putBoolean("matureChkBox", false); } } if (!sPref.contains("version")) { ApplicationAptoide.setRestartLauncher(true); try { editor.putInt("version", getPackageManager().getPackageInfo(getPackageName(), 0).versionCode); } catch (NameNotFoundException e) { e.printStackTrace(); } } if (sPref.getString("myId", null) == null) { String rand_id = UUID.randomUUID().toString(); editor.putString("myId", rand_id); } if (sPref.getInt("scW", 0) == 0 || sPref.getInt("scH", 0) == 0) { DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); editor.putInt("scW", dm.widthPixels); editor.putInt("scH", dm.heightPixels); } editor.commit(); File file = new File(LOCAL_PATH + "/apks"); if (!file.exists()) { file.mkdirs(); } new Thread(new Runnable() { @Override public void run() { // Note the L that tells the compiler to interpret the // number as a Long final long MAXFILEAGE = 2678400000L; // 1 month in // milliseconds // Get file handle to the directory. In this case the // application files dir File dir = new File(LOCAL_PATH + "/apks"); // Optain list of files in the directory. // listFiles() returns a list of File objects to each // file found. File[] files = dir.listFiles(); // Loop through all files for (File f : files) { // Get the last modified date. Miliseconds since // 1970 long lastmodified = f.lastModified(); // Do stuff here to deal with the file.. // For instance delete files older than 1 month if (lastmodified + MAXFILEAGE < System.currentTimeMillis()) { f.delete(); } } } }).start(); db = Database.getInstance(); Intent i = new Intent(mContext, MainService.class); startService(i); bindService(i, conn, Context.BIND_AUTO_CREATE); order = Order.values()[PreferenceManager.getDefaultSharedPreferences(mContext).getInt("order_list", 0)]; registerReceiver(updatesReceiver, new IntentFilter("update")); registerReceiver(statusReceiver, new IntentFilter("status")); registerReceiver(loginReceiver, new IntentFilter("login")); registerReceiver(storePasswordReceiver, new IntentFilter("401")); registerReceiver(redrawInstalledReceiver, new IntentFilter("pt.caixamagica.aptoide.REDRAW")); if (!ApplicationAptoide.MULTIPLESTORES) { registerReceiver(parseFailedReceiver, new IntentFilter("PARSE_FAILED")); } registerReceiver(newRepoReceiver, new IntentFilter("pt.caixamagica.aptoide.NEWREPO")); registered = true; categoriesStrings = new HashMap<String, Integer>(); // categoriesStrings.put("Applications", R.string.applications); boolean serversFileIsEmpty = true; if (sPref.getBoolean("firstrun", true)) { // Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); // shortcutIntent.setClassName("cm.aptoide.pt", // "cm.aptoide.pt.Start"); // final Intent intent = new Intent(); // intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, // shortcutIntent); // // intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, // getString(R.string.app_name)); // Parcelable iconResource = // Intent.ShortcutIconResource.fromContext(this, // R.drawable.ic_launcher); // // intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, // iconResource); // intent.putExtra("duplicate", false); // intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); // sendBroadcast(intent); if (new File(LOCAL_PATH + "/servers.xml").exists() && ApplicationAptoide.DEFAULTSTORENAME == null) { try { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); MyappHandler handler = new MyappHandler(); sp.parse(new File(LOCAL_PATH + "/servers.xml"), handler); ArrayList<String> server = handler.getServers(); if (server.isEmpty()) { serversFileIsEmpty = true; } else { getIntent().putExtra("newrepo", server); } } catch (Exception e) { e.printStackTrace(); } } editor.putBoolean("firstrun", false); editor.putBoolean("orderByCategory", true); editor.commit(); } if (getIntent().hasExtra("newrepo")) { ArrayList<String> repos = (ArrayList<String>) getIntent().getSerializableExtra("newrepo"); for (final String uri2 : repos) { View simpleView = LayoutInflater.from(mContext).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(mContext).setView(simpleView); final AlertDialog addNewRepoDialog = dialogBuilder.create(); addNewRepoDialog.setTitle(getString(R.string.add_store)); addNewRepoDialog.setIcon(android.R.drawable.ic_menu_add); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText((getString(R.string.newrepo_alrt) + uri2 + " ?")); addNewRepoDialog.setCancelable(false); addNewRepoDialog.setButton(Dialog.BUTTON_POSITIVE, getString(android.R.string.yes), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { dialogAddStore(uri2, null, null); } }); addNewRepoDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.no), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { dialog.cancel(); } }); addNewRepoDialog.show(); } } else if (db.getStores(false).getCount() == 0 && ApplicationAptoide.DEFAULTSTORENAME == null && serversFileIsEmpty) { View simpleView = LayoutInflater.from(mContext).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(mContext).setView(simpleView); final AlertDialog addAppsRepoDialog = dialogBuilder.create(); addAppsRepoDialog.setTitle(getString(R.string.add_store)); addAppsRepoDialog.setIcon(android.R.drawable.ic_menu_add); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText(getString(R.string.myrepo_alrt) + "\n" + "http://apps.store.aptoide.com/"); addAppsRepoDialog.setCancelable(false); addAppsRepoDialog.setButton(Dialog.BUTTON_POSITIVE, getString(android.R.string.yes), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { dialogAddStore("http://apps.store.aptoide.com", null, null); } }); addAppsRepoDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.no), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { dialog.cancel(); } }); addAppsRepoDialog.show(); } new Thread(new Runnable() { @Override public void run() { try { getUpdateParameters(); if (getPackageManager().getPackageInfo(getPackageName(), 0).versionCode < Integer .parseInt(updateParams.get("versionCode"))) { runOnUiThread(new Runnable() { @Override public void run() { requestUpdateSelf(); } }); } } catch (Exception e) { e.printStackTrace(); } } }).start(); } featuredView = LayoutInflater.from(mContext).inflate(R.layout.page_featured, null); availableView = LayoutInflater.from(mContext).inflate(R.layout.page_available, null); updateView = LayoutInflater.from(mContext).inflate(R.layout.page_updates, null); banner = (LinearLayout) availableView.findViewById(R.id.banner); breadcrumbs = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.breadcrumb_container, null); installedView = new ListView(mContext); updatesListView = (ListView) updateView.findViewById(R.id.updates_list); availableListView = (ListView) availableView.findViewById(R.id.available_list); joinStores = (CheckBox) availableView.findViewById(R.id.join_stores); availableAdapter = new AvailableListAdapter(mContext, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); installedAdapter = new InstalledAdapter(mContext, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, db); updatesAdapter = new UpdatesAdapter(mContext, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); pb = (TextView) availableView.findViewById(R.id.loading_pb); addStoreButton = availableView.findViewById(R.id.add_store); bannerStoreAvatar = (ImageView) banner.findViewById(R.id.banner_store_avatar); bannerStoreName = (TextView) banner.findViewById(R.id.banner_store_name); bannerStoreDescription = (AutoScaleTextView) banner.findViewById(R.id.banner_store_description); } }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public void promptMachineName(final Activity activity) { final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Machine Name"); EditText searchView = new EditText(activity); searchView.setEnabled(true);// w w w .j a v a 2s. com searchView.setVisibility(View.VISIBLE); searchView.setId(201012010); searchView.setSingleLine(); alertDialog.setView(searchView); final Handler handler = this.handler; // alertDialog.setMessage(body); alertDialog.setButton("Create", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // UIUtils.log("Searching..."); EditText a = (EditText) alertDialog.findViewById(201012010); sendHandlerMessage(handler, Const.VM_CREATED, "machine_name", a.getText().toString()); return; } }); alertDialog.show(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public void promptStateName(final Activity activity) { final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Snapshot/State Name"); EditText searchView = new EditText(activity); searchView.setEnabled(true);//from www . j a v a2 s. c o m searchView.setVisibility(View.VISIBLE); searchView.setId(201012010); searchView.setSingleLine(); alertDialog.setView(searchView); final Handler handler = this.handler; // alertDialog.setMessage(body); alertDialog.setButton("Create", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // UIUtils.log("Searching..."); EditText a = (EditText) alertDialog.findViewById(201012010); sendHandlerMessage(handler, Const.SNAPSHOT_CREATED, new String[] { "snapshot_name" }, new String[] { a.getText().toString() }); return; } }); alertDialog.show(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
private void promptPrio(final Activity activity) { // TODO Auto-generated method stub final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Enable High Priority!"); TextView textView = new TextView(activity); textView.setVisibility(View.VISIBLE); textView.setId(201012010);/* ww w.j a v a 2 s.com*/ textView.setText( "Warning! High Priority might increase emulation speed but " + "will slow your phone down!"); alertDialog.setView(textView); final Handler handler = this.handler; // alertDialog.setMessage(body); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { LimboSettingsManager.setPrio(activity, true); } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mPrio.setChecked(false); return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mPrio.setChecked(false); } }); alertDialog.show(); }