List of usage examples for android.app AlertDialog show
public void show()
From source file:self.philbrown.droidQuery.$.java
/** * Uses the current context to show an alert dialog. * @param title the alert title//from w w w.j a v a 2 s. c o m * @param text the alert message. * @see #alert(String) */ public void alert(String title, String text) { AlertDialog alert = new AlertDialog.Builder(context).create(); alert.setTitle(title); alert.setMessage(text); alert.setButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); }
From source file:com.xmobileapp.rockplayer.RockPlayer.java
/******************************************* * /* w w w. java2s .c om*/ * Lite version popup * *******************************************/ public void showLitePopup() { AlertDialog alertDialog = new AlertDialog.Builder(this).setIcon(R.drawable.icon).setTitle("Lite Version") .setMessage( "This option is available in the full version of RockOn. You can get it for free from the RockOn website," + " but if you like the concept and wish to support further development, please consider buying it from the " + "Android Market.") .setPositiveButton("Get it!", liteClickListener).create(); alertDialog.show(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
private void promptImportMachines() { // TODO Auto-generated method stub final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Import Machines"); RelativeLayout mLayout = new RelativeLayout(this); mLayout.setId(12222);//from w ww . ja v a 2s .c om TextView imageNameView = new TextView(activity); imageNameView.setVisibility(View.VISIBLE); imageNameView.setId(201012010); imageNameView.setText( "Step 1: Place the machine.CSV file you export previously under \"limbo\" directory in your SD card.\n" + "Step 2: WARNING: Any machine with the same name will be replaced!\n" + "Step 3: Press \"OK\".\n"); RelativeLayout.LayoutParams searchViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); mLayout.addView(imageNameView, searchViewParams); alertDialog.setView(mLayout); final Handler handler = this.handler; // alertDialog.setMessage(body); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // For each line create a Machine progDialog = ProgressDialog.show(activity, "Please Wait", "Importing Machines...", true); ImportMachines importer = new ImportMachines(); importer.execute(); } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { return; } }); alertDialog.show(); }
From source file:com.df.dfcarchecker.CarCheck.CarCheckBasicInfoFragment.java
private void selectCarManually() { View view = this.inflater.inflate(R.layout.dialog_vehiclemodel_select, null); countrySpinner = (Spinner) view.findViewById(R.id.country_spinner); brandSpinner = (Spinner) view.findViewById(R.id.brand_spinner); manufacturerSpinner = (Spinner) view.findViewById(R.id.production_spinner); seriesSpinner = (Spinner) view.findViewById(R.id.serial_spinner); modelSpinner = (Spinner) view.findViewById(R.id.model_spinner); AlertDialog dialog = new AlertDialog.Builder(rootView.getContext()).setView(view).setTitle("") .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // // ?? if (countrySpinner.getSelectedItemPosition() > 1) { isPorted = true; } else { isPorted = false; }/* w w w . ja v a 2 s . c o m*/ // ? lastCountryIndex = countrySpinner.getSelectedItemPosition(); lastBrandIndex = brandSpinner.getSelectedItemPosition(); lastManufacturerIndex = manufacturerSpinner.getSelectedItemPosition(); lastSeriesIndex = seriesSpinner.getSelectedItemPosition(); lastModelIndex = modelSpinner.getSelectedItemPosition(); // ?Spinner? if (lastCountryIndex == 0 || lastBrandIndex == 0 || lastManufacturerIndex == 0 || lastSeriesIndex == 0 || lastModelIndex == 0) { Toast.makeText(rootView.getContext(), "", Toast.LENGTH_SHORT) .show(); return; } Country country = vehicleModel.countries.get(lastCountryIndex - 1); Brand brand = country.brands.get(lastBrandIndex - 1); Manufacturer manufacturer = brand.manufacturers.get(lastManufacturerIndex - 1); Series series = manufacturer.serieses.get(lastSeriesIndex - 1); Model model = series.models.get(lastModelIndex - 1); // ?seriesIdmodelId??? getCarSettingsFromServer(series.id + "," + model.id); // String brandString = manufacturerSpinner.getSelectedItem().toString() + " " + seriesSpinner.getSelectedItem().toString() + " " + modelSpinner.getSelectedItem().toString(); // ? String displacementString = modelSpinner.getSelectedItem().toString(); if (displacementString.length() > 3) { displacementString = displacementString.substring(0, 3); } mCarSettings.setBrandString(brandString); mCarSettings.setDisplacement(displacementString); mCarSettings.setCountry(country); mCarSettings.setBrand(brand); mCarSettings.setManufacturer(manufacturer); mCarSettings.setSeries(series); mCarSettings.setModel(model); setCarSettings(model.getName()); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // ? lastCountryIndex = countrySpinner.getSelectedItemPosition(); lastBrandIndex = brandSpinner.getSelectedItemPosition(); lastManufacturerIndex = manufacturerSpinner.getSelectedItemPosition(); lastSeriesIndex = seriesSpinner.getSelectedItemPosition(); lastModelIndex = modelSpinner.getSelectedItemPosition(); } }).create(); setCountrySpinner(vehicleModel); dialog.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);/*ww w. j a v a 2 s .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:com.max2idea.android.limbo.main.LimboActivity.java
public void promptVNCAllowExternal(final Activity activity) { final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Enable VNC server"); TextView textView = new TextView(activity); textView.setVisibility(View.VISIBLE); textView.setId(201012010);//from w ww. ja va 2s. c o m textView.setText("VNC Server: " + this.getLocalIpAddress() + ":" + "5901\n" + "Warning: VNC is not secure make sure you're on a private network!\n"); EditText passwdView = new EditText(activity); passwdView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); passwdView.setHint("Password"); passwdView.setEnabled(true); passwdView.setVisibility(View.VISIBLE); passwdView.setId(11111); passwdView.setSingleLine(); RelativeLayout mLayout = new RelativeLayout(this); mLayout.setId(12222); RelativeLayout.LayoutParams textViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); textViewParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, mLayout.getId()); mLayout.addView(textView, textViewParams); RelativeLayout.LayoutParams passwordViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); passwordViewParams.addRule(RelativeLayout.BELOW, textView.getId()); // passwordViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, // mLayout.getId()); mLayout.addView(passwdView, passwordViewParams); alertDialog.setView(mLayout); final Handler handler = this.handler; alertDialog.setButton("Set", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // UIUtils.log("Searching..."); EditText a = (EditText) alertDialog.findViewById(11111); if (a.getText().toString().trim().equals("")) { Toast.makeText(getApplicationContext(), "Password cannot be empty!", Toast.LENGTH_SHORT).show(); vnc_passwd = null; vnc_allow_external = 0; mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); return; } else { sendHandlerMessage(handler, Const.VNC_PASSWORD, "vnc_passwd", "passwd"); vnc_passwd = a.getText().toString(); vnc_allow_external = 1; // LimboSettingsManager.setVNCAllowExternal(activity, true); } } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { vnc_passwd = null; vnc_allow_external = 0; mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); vnc_passwd = null; vnc_allow_external = 0; } }); alertDialog.show(); }
From source file:com.lgallardo.qbittorrentclient.RefreshListener.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Builder builder;/*from w w w. j av a 2 s. com*/ AlertDialog dialog; if (drawerToggle.onOptionsItemSelected(item)) { return true; } // Enable title (just in case) getSupportActionBar().setDisplayShowTitleEnabled(true); switch (item.getItemId()) { case R.id.action_refresh: swipeRefresh(); return true; case R.id.action_add_file: // Add torrent file openFilePicker(); return true; case R.id.action_add_url: // Add torrent URL addUrlTorrent(); return true; case R.id.action_rss: // Open RSS Activity Intent intent = new Intent(getBaseContext(), com.lgallardo.qbittorrentclient.RSSFeedActivity.class); startActivity(intent); return true; case R.id.action_pause: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { pauseTorrent(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_resume: if (TorrentDetailsFragment.hashToUpdate != null) { startTorrent(TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_delete: okay = false; if (!isFinishing()) { builder = new Builder(this); // Message builder.setMessage(R.string.dm_deleteTorrent).setTitle(R.string.dt_deleteTorrent); // Cancel builder.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog okay = false; } }); // Ok builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User accepted the dialog if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { deleteTorrent(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); if (findViewById(R.id.one_frame) != null) { popBackStackPhoneView(); } } } }); // Create dialog dialog = builder.create(); // Show dialog dialog.show(); } return true; case R.id.action_delete_drive: if (!isFinishing()) { builder = new Builder(this); // Message builder.setMessage(R.string.dm_deleteDriveTorrent).setTitle(R.string.dt_deleteDriveTorrent); // Cancel builder.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User canceled the dialog } }); // Ok builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User accepted the dialog if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { deleteDriveTorrent(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); if (findViewById(R.id.one_frame) != null) { popBackStackPhoneView(); } } } }); // Create dialog dialog = builder.create(); // Show dialog dialog.show(); } return true; case R.id.action_increase_prio: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { increasePrioTorrent(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_decrease_prio: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { decreasePrioTorrent(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_max_prio: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { maxPrioTorrent(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_min_prio: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { minPrioTorrent(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_resume_all: resumeAllTorrents(); return true; case R.id.action_pause_all: pauseAllTorrents(); return true; case R.id.action_upload_rate_limit: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { uploadRateLimitDialog(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_download_rate_limit: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { downloadRateLimitDialog(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_recheck: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { recheckTorrents(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_first_last_piece_prio: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { toggleFirstLastPiecePrio(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_sequential_download: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { toggleSequentialDownload(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_set_label: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { setLabelDialog(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_delete_label: if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { setLabel(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate, " "); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } } return true; case R.id.action_toggle_alternative_rate: toggleAlternativeSpeedLimits(); refreshAfterCommand(2); swipeRefresh(); // if (findViewById(R.id.one_frame) != null) { // popBackStackPhoneView(); // } return true; case R.id.action_sortby_name: saveSortBy(SORTBY_NAME); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_size: saveSortBy(SORTBY_SIZE); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_eta: saveSortBy(SORTBY_ETA); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_priority: saveSortBy(SORTBY_PRIORITY); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_progress: saveSortBy(SORTBY_PROGRESS); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_ratio: saveSortBy(SORTBY_RATIO); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_downloadSpeed: saveSortBy(SORTBY_DOWNLOAD); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_uploadSpeed: saveSortBy(SORTBY_UPLOAD); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_added_on: saveSortBy(SORTBY_ADDEDON); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_completed_on: saveSortBy(SORTBY_COMPLETEDON); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_sortby_reverse_order: saveReverseOrder(!reverse_order); invalidateOptionsMenu(); swipeRefresh(); return true; case R.id.action_add_tracker: // Log.d("Debug", "Adding tracker"); if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate != null) { addUrlTracker(com.lgallardo.qbittorrentclient.TorrentDetailsFragment.hashToUpdate); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public void promptImageName(final Activity activity, String hd) { final String hd_string = hd; final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Image Name"); RelativeLayout mLayout = new RelativeLayout(this); mLayout.setId(12222);//from www.jav a 2s.com EditText imageNameView = new EditText(activity); imageNameView.setEnabled(true); imageNameView.setVisibility(View.VISIBLE); imageNameView.setId(201012010); imageNameView.setSingleLine(); RelativeLayout.LayoutParams searchViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); mLayout.addView(imageNameView, searchViewParams); final Spinner size = new Spinner(this); RelativeLayout.LayoutParams setPlusParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); size.setId(201012044); String[] arraySpinner = new String[7]; for (int i = 0; i < arraySpinner.length; i++) { if (i < 5) { arraySpinner[i] = (i + 1) + " GB"; } } arraySpinner[5] = "10 GB"; arraySpinner[6] = "20 GB"; ArrayAdapter sizeAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, arraySpinner); sizeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); size.setAdapter(sizeAdapter); setPlusParams.addRule(RelativeLayout.BELOW, imageNameView.getId()); mLayout.addView(size, setPlusParams); // TODO: Not working for now // final TextView preallocText = new TextView(this); // preallocText.setText("Preallocate? "); // preallocText.setTextSize(15); // RelativeLayout.LayoutParams preallocTParams = new // RelativeLayout.LayoutParams( // RelativeLayout.LayoutParams.WRAP_CONTENT, // RelativeLayout.LayoutParams.WRAP_CONTENT); // preallocTParams.addRule(RelativeLayout.BELOW, size.getId()); // mLayout.addView(preallocText, preallocTParams); // preallocText.setId(64512044); // // final CheckBox prealloc = new CheckBox(this); // RelativeLayout.LayoutParams preallocParams = new // RelativeLayout.LayoutParams( // RelativeLayout.LayoutParams.WRAP_CONTENT, // RelativeLayout.LayoutParams.WRAP_CONTENT); // preallocParams.addRule(RelativeLayout.BELOW, size.getId()); // preallocParams.addRule(RelativeLayout.RIGHT_OF, // preallocText.getId()); // preallocParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, // preallocText.getId()); // mLayout.addView(prealloc, preallocParams); // prealloc.setId(64512344); alertDialog.setView(mLayout); final Handler handler = this.handler; // alertDialog.setMessage(body); alertDialog.setButton("Create", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { int sizeSel = size.getSelectedItemPosition(); String templateImage = "hd1g.qcow2"; if (sizeSel < 5) { templateImage = "hd" + (sizeSel + 1) + "g.qcow2"; } else if (sizeSel == 5) { templateImage = "hd10g.qcow2"; } else if (sizeSel == 6) { templateImage = "hd20g.qcow2"; } // UIUtils.log("Searching..."); EditText a = (EditText) alertDialog.findViewById(201012010); progDialog = ProgressDialog.show(activity, "Please Wait", "Creating HD Image...", true); // CreateImage createImg = new // CreateImage(a.getText().toString(), // hd_string, sizeInt, prealloc.isChecked()); // CreateImage createImg = new CreateImage(a.getText().toString(), // hd_string, sizeInt, false); // createImg.execute(); String image = a.getText().toString(); if (!image.endsWith(".qcow2")) { image += ".qcow2"; } createImg(templateImage, image, hd_string); } }); alertDialog.show(); }