List of usage examples for android.app AlertDialog.Builder show
public void show()
From source file:ca.mudar.mtlaucasou.BaseMapActivity.java
/** * Show dialog to type postal code for Geocode search. */// w w w . ja v a 2 s . com private void showPostalCodeDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.dialog_postal_code_title); alert.setMessage(R.string.dialog_postal_code_summary); final EditText input = new EditText(this); input.setInputType(InputType.TYPE_CLASS_TEXT); input.setHint(R.string.input_hint_postal_code); alert.setView(input); alert.setPositiveButton(R.string.dialog_btn_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /** * Store value and show processing dialog. Geocode search will * be done in a thread. */ postalCode = input.getText().toString(); showDialogProcessing(); } }); alert.setNegativeButton(R.string.dialog_btn_cancel, null); alert.show(); }
From source file:br.com.thinkti.android.filechooserfrag.fragFileChooser.java
public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if ((!currentDir.getName().equals("sdcard")) && (currentDir.getParentFile() != null)) { AlertDialog.Builder A = new AlertDialog.Builder(getActivity()); A.setPositiveButton(getString(R.string.yes), new AlertDialog.OnClickListener() { @Override//from w w w . j a va 2 s .c om public void onClick(DialogInterface dialog, int which) { _main.mPager.setCurrentItem(_MainActivity.fragID); } }); A.setNegativeButton(getString(R.string.no), new AlertDialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { currentDir = currentDir.getParentFile(); fill(currentDir); } }); A.setMessage(getString(R.string.close)); A.setTitle(_main.getString((R.string.question))); A.show(); } else { _main.mPager.setCurrentItem(_MainActivity.fragID); } return false; } return true; }
From source file:at.tomtasche.reader.ui.activity.MainActivity.java
public void findDocument() { final Intent intent = new Intent(Intent.ACTION_GET_CONTENT); // remove mime-type because most apps don't support ODF mime-types intent.setType("application/*"); intent.addCategory(Intent.CATEGORY_OPENABLE); PackageManager pm = getPackageManager(); final List<ResolveInfo> targets = pm.queryIntentActivities(intent, 0); int size = targets.size(); String[] targetNames = new String[size]; for (int i = 0; i < size; i++) { targetNames[i] = targets.get(i).loadLabel(pm).toString(); }/*from www.jav a 2 s. c o m*/ AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.dialog_choose_filemanager); builder.setItems(targetNames, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ResolveInfo target = targets.get(which); if (target == null) { return; } intent.setComponent(new ComponentName(target.activityInfo.packageName, target.activityInfo.name)); try { startActivityForResult(intent, 42); } catch (Exception e) { e.printStackTrace(); showCrouton(R.string.crouton_error_open_app, new Runnable() { @Override public void run() { findDocument(); } }, AppMsg.STYLE_ALERT); } dialog.dismiss(); } }); builder.show(); }
From source file:gr.scify.newsum.ui.SearchViewActivity.java
private void initTopicSpinner() { // Get topics in category. Null accepts all user sources. Modify // according to user selection final String[] saTopicIDs = SearchTopicActivity.saTopicIDs; final String[] saTitles = SearchTopicActivity.saTopicTitles; final String[] saDates = SearchTopicActivity.saTopicDates; // TODO add TopicInfo for SearchResults as well and parse accordingly // final String[] saTopicIDs = extras.getStringArray("searchresults"); final TextView title = (TextView) findViewById(R.id.title); // Fill topic spinner ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item, saTitles); final TextView tx = (TextView) findViewById(R.id.textView1); // tx.setMovementMethod(LinkMovementMethod.getInstance()); // final float minm = tx.getTextSize(); // final float maxm = (minm + 24); // create an invisible spinner just to control the summaries of the // category (i will use it later on Swipe) Spinner spinner = (Spinner) findViewById(R.id.spinner1); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter);/*from w w w. ja v a 2s.c om*/ // Scroll view init final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView1); // Add selection event spinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // Show waiting dialog showWaitingDialog(); // Changing summary loading = true; // Update visibility of rating bar final RatingBar rb = (RatingBar) findViewById(R.id.ratingBar); rb.setRating(0.0f); rb.setVisibility(View.VISIBLE); final TextView rateLbl = (TextView) findViewById(R.id.rateLbl); rateLbl.setVisibility(View.VISIBLE); scroll.scrollTo(0, 0); // String[] saTopicIDs = sTopicIds.split(sSeparator); SharedPreferences settings = getSharedPreferences("urls", 0); // get user settings for sources String UserSources = settings.getString("UserLinks", "All"); String[] Summary = NewSumServiceClient.getSummary(saTopicIDs[arg2], UserSources); if (Summary.length == 0) { // WORK. Updated: CHECK // Close waiting dialog closeWaitingDialog(); AlertDialog.Builder alert = new AlertDialog.Builder(SearchViewActivity.this); alert.setMessage(R.string.shouldReloadSummaries); alert.setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { startActivity(new Intent(getApplicationContext(), NewSumUiActivity.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); } }); alert.setCancelable(false); alert.show(); loading = false; return; } // track summary views per Search and topic title if (getAnalyticsPref()) { EasyTracker.getTracker().sendEvent(VIEW_SUMMARY_ACTION, "From Search", saTitles[arg2] + ": " + saDates[arg2], 0l); } // Generate summary text sText = ViewActivity.generateSummaryText(Summary, SearchViewActivity.this); pText = ViewActivity.generatesummarypost(Summary, SearchViewActivity.this); tx.setText(Html.fromHtml(sText)); tx.setMovementMethod(LinkMovementMethod.getInstance()); title.setText(saTitles[arg2] + ": " + saDates[arg2]); float defSize = tx.getTextSize(); SharedPreferences usersize = getSharedPreferences("textS", 0); float newSize = usersize.getFloat("size", defSize); tx.setTextSize(TypedValue.COMPLEX_UNIT_PX, newSize); // update the TopicActivity with viewed item TopicActivity.addVisitedTopicID(saTopicIDs[arg2]); // Close waiting dialog closeWaitingDialog(); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); }
From source file:br.com.GUI.perfil.SelecionarTipoDeLogin.java
public void loginComFacebook(View v) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("Selecione seu tipo de Perfil"); alertDialog.setMessage(/*from w ww. java 2 s . co m*/ "O WorkUp util tanto para treinadores quanto para alunos, por favor, \nselecione abaixo qual o tipo de perfil que voc deseja criar."); alertDialog.setIcon(R.drawable.profile); alertDialog.setPositiveButton("Treinador", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { whatTypeIs = "personal"; loginComFacebook(); } }); alertDialog.setNegativeButton("Aluno", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { whatTypeIs = "aluno"; loginComFacebook(); } }); // Showing Alert Message alertDialog.show(); }
From source file:net.evecom.android.web.Web5Activity.java
/** * /*from w w w.j av a2 s . c o m*/ * * @param v */ public void message_post_web_tomain(View v) { AlertDialog.Builder builder1 = new AlertDialog.Builder(Web5Activity.this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage(""); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); builder1.setNegativeButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); }
From source file:net.evecom.android.web.Web4Activity.java
/** * //from w w w . ja va 2 s. c o m * * @param v */ public void message_post_web_tomain(View v) { AlertDialog.Builder builder1 = new AlertDialog.Builder(Web4Activity.this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage(""); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); builder1.setNegativeButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); }
From source file:com.houseofslack.pullscoring.Scoring.java
public void clickGoUndo(View unused) { int team0Score = getScore(R.id.left_score_input); int team1Score = getScore(R.id.right_score_input); // if both scores are 0, this is an undo, not a go // but, if there are no scores, do nothing if ((team0Score == 0) && (team1Score == 0)) { // attempted undo, check for any scores in the list if (!team0Scores.isEmpty() && !team1Scores.isEmpty()) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.undo_confirm_message); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override//from ww w.j ava 2 s . co m public void onClick(DialogInterface arg0, int arg1) { // remove the last scores from the list team0Scores.remove(team0Scores.size() - 1); team1Scores.remove(team1Scores.size() - 1); redrawScores(); // make sure we update the button in the middle setGoButtonCaption(); // make sure the first input is selected clickLeftInput(null); } }); builder.setNegativeButton(R.string.cancel, null); builder.show(); } } else { // we have scores (at least one), add them to the lists, clear the strings, // and then redraw team0Scores.add(team0Score); team1Scores.add(team1Score); clearScores(); redrawScores(); // make sure we update the button in the middle setGoButtonCaption(); // make sure the first input is selected clickLeftInput(null); } }
From source file:org.openhab.habdroid.ui.OpenHABDiscoveryInboxFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { selectedInbox = position; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setPositiveButton(R.string.app_discoveryinbox_approve, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { sendInboxApprove(mDiscoveryInboxAdapter.getItem(selectedInbox).getThingUID()); }//w w w .ja v a 2 s . c om }); builder.setNeutralButton(R.string.app_discoveryinbox_ignore, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { sendInboxIgnore(mDiscoveryInboxAdapter.getItem(selectedInbox).getThingUID()); } }); builder.setNegativeButton(R.string.app_discoveryinbox_delete, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { sendInboxDelete(mDiscoveryInboxAdapter.getItem(selectedInbox).getThingUID()); } }); builder.setCancelable(true); builder.setTitle(R.string.app_discoveryinbox_deviceaction); builder.show(); }
From source file:br.com.GUI.avaliacoes.AvaliarPerimetria.java
public void tirarFoto() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setTitle("Selecione o mtodo"); alertDialog.setMessage("Deseja usar qual aplicativo para importar sua foto?"); alertDialog.setIcon(R.drawable.profile); alertDialog.setPositiveButton("Camera", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { usarCamera();/*from w w w . j a v a2s . c om*/ } }); alertDialog.setNegativeButton("Galeria", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { usarGaleria(); dialog.cancel(); } }); alertDialog.show(); }