List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
From source file:com.cdvdev.subscriptiondemo.helpers.IabHelper.java
/** * Method for showing errors/*ww w. j ava 2s .c om*/ * * @param message - Error message */ public void showAlertDialog(String message) { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage(message).setNeutralButton(android.R.string.ok, null).create().show(); }
From source file:com.dahl.brendan.wordsearch.view.WordSearchActivity.java
@Override protected Dialog onCreateDialog(int id) { Dialog dialog;//www.j a v a2 s . c o m switch (id) { case DIALOG_ID_NO_WORDS: { final DialogNoWordsListener DIALOG_LISTENER_NO_WORDS = new DialogNoWordsListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.no_words); builder.setNegativeButton(R.string.category, DIALOG_LISTENER_NO_WORDS); builder.setPositiveButton(R.string.new_game, DIALOG_LISTENER_NO_WORDS); builder.setNeutralButton(R.string.size, DIALOG_LISTENER_NO_WORDS); dialog = builder.create(); break; } case DIALOG_ID_NO_WORDS_CUSTOM: { final DialogNoWordsCustomListener DIALOG_LISTENER_NO_WORDS_CUSTOM = new DialogNoWordsCustomListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.no_words_custom); builder.setNegativeButton(R.string.category, DIALOG_LISTENER_NO_WORDS_CUSTOM); builder.setPositiveButton(R.string.custom_editor, DIALOG_LISTENER_NO_WORDS_CUSTOM); dialog = builder.create(); break; } case DIALOG_ID_GAME_OVER: { final DialogGameOverListener DIALOG_LISTENER_GAME_OVER = new DialogGameOverListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("blank"); EditText text = new EditText(this); text.setSingleLine(); text.setId(android.R.id.input); builder.setView(text); builder.setPositiveButton(R.string.SAVE_SUBMIT, DIALOG_LISTENER_GAME_OVER); builder.setNeutralButton(R.string.SAVE, DIALOG_LISTENER_GAME_OVER); builder.setOnCancelListener(DIALOG_LISTENER_GAME_OVER); dialog = builder.create(); break; } case DIALOG_ID_HIGH_SCORES_LOCAL_SHOW: { final DialogHighScoresLocalShowListener DIALOG_LISTENER_HIGH_SCORES_SHOW = new DialogHighScoresLocalShowListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("blank"); builder.setTitle(R.string.LOCAL_HIGH_SCORES); builder.setNegativeButton(R.string.reset, DIALOG_LISTENER_HIGH_SCORES_SHOW); builder.setNeutralButton(android.R.string.ok, DIALOG_LISTENER_HIGH_SCORES_SHOW); builder.setPositiveButton(R.string.GLOBAL, DIALOG_LISTENER_HIGH_SCORES_SHOW); dialog = builder.create(); break; } case DIALOG_ID_GAME_NEW: { final DialogGameNewListener DIALOG_LISTENER_GAME_NEW = new DialogGameNewListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(this.getString(R.string.game_over)); builder.setPositiveButton(R.string.new_game, DIALOG_LISTENER_GAME_NEW); builder.setNeutralButton(R.string.REPLAY, DIALOG_LISTENER_GAME_NEW); builder.setNegativeButton(android.R.string.cancel, DIALOG_LISTENER_GAME_NEW); dialog = builder.create(); break; } case DIALOG_ID_INTRO_INPUT_TYPE: { final DialogIntroListener DIALOG_LISTENER_INTRO = new DialogIntroListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.INTRO); builder.setPositiveButton(R.string.tap, DIALOG_LISTENER_INTRO); builder.setNeutralButton(android.R.string.cancel, DIALOG_LISTENER_INTRO); builder.setNegativeButton(R.string.drag, DIALOG_LISTENER_INTRO); dialog = builder.create(); break; } case DIALOG_ID_INTRO_DONATE: { final DialogInterface.OnClickListener LISTENER = new DialogIntroDonateListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.INTRO_DONATE_MSG); builder.setPositiveButton(R.string.DONATE, LISTENER); builder.setNegativeButton(R.string.DONATE_NO, LISTENER); dialog = builder.create(); break; } case DIALOG_ID_DONATE: { final DialogInterface.OnClickListener LISTENER = new DialogDonateListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.DONATE_MSG); builder.setPositiveButton(R.string.DONATE_MARKET, LISTENER); builder.setNeutralButton(R.string.DONATE_WEB, LISTENER); builder.setNegativeButton(R.string.DONATE_NO, LISTENER); dialog = builder.create(); break; } default: dialog = super.onCreateDialog(id); break; } return dialog; }
From source file:net.evecom.androidecssp.base.BaseActivity.java
/** * /*from w ww . j a v a 2 s . co m*/ * * @param errorMsg */ protected void dialogToast(String errorMsg, final ICallback callback) { AlertDialog.Builder builder1 = new AlertDialog.Builder(this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage("" + errorMsg); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { if (null != callback) { callback.execute(); } } }); builder1.show(); }
From source file:com.dvn.vindecoder.ui.seller.AddVehicalAndPayment.java
private void startDilog() { AlertDialog.Builder myAlertDilog = new AlertDialog.Builder(AddVehicalAndPayment.this); myAlertDilog.setTitle("Upload picture option.."); myAlertDilog.setMessage("Take Photo"); myAlertDilog.setPositiveButton("Gallery", new DialogInterface.OnClickListener() { @Override// ww w .j a v a2 s . c om public void onClick(DialogInterface dialog, int which) { Intent picIntent = new Intent(Intent.ACTION_GET_CONTENT, null); picIntent.setType("image/*"); picIntent.putExtra("return_data", true); startActivityForResult(picIntent, GALLERY_REQUEST); } }); myAlertDilog.setNegativeButton("Camera", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (checkPermission(Manifest.permission.CAMERA, AddVehicalAndPayment.this)) { openCameraApplication(); } else { requestPermission(AddVehicalAndPayment.this, new String[] { Manifest.permission.CAMERA }, REQUEST_ACESS_CAMERA); } } else { openCameraApplication(); } } }); myAlertDilog.show(); }
From source file:ws.crandell.newspaperpuzzles.wordsearch.view.WordSearchActivity.java
@Override protected Dialog onCreateDialog(int id) { Dialog dialog;//from w w w.ja va2 s . c om switch (id) { case DIALOG_ID_NO_WORDS: { final DialogNoWordsListener DIALOG_LISTENER_NO_WORDS = new DialogNoWordsListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.ws_no_words); builder.setNegativeButton(R.string.ws_category, DIALOG_LISTENER_NO_WORDS); builder.setPositiveButton(R.string.ws_new_game, DIALOG_LISTENER_NO_WORDS); builder.setNeutralButton(R.string.ws_size, DIALOG_LISTENER_NO_WORDS); dialog = builder.create(); break; } case DIALOG_ID_NO_WORDS_CUSTOM: { final DialogNoWordsCustomListener DIALOG_LISTENER_NO_WORDS_CUSTOM = new DialogNoWordsCustomListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.ws_no_words_custom); builder.setNegativeButton(R.string.ws_category, DIALOG_LISTENER_NO_WORDS_CUSTOM); builder.setPositiveButton(R.string.ws_custom_editor, DIALOG_LISTENER_NO_WORDS_CUSTOM); dialog = builder.create(); break; } case DIALOG_ID_GAME_OVER: { final DialogGameOverListener DIALOG_LISTENER_GAME_OVER = new DialogGameOverListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("blank"); EditText text = new EditText(this); text.setSingleLine(); text.setId(android.R.id.input); builder.setView(text); builder.setPositiveButton(R.string.ws_SAVE_SUBMIT, DIALOG_LISTENER_GAME_OVER); builder.setNeutralButton(R.string.ws_SAVE, DIALOG_LISTENER_GAME_OVER); builder.setOnCancelListener(DIALOG_LISTENER_GAME_OVER); dialog = builder.create(); break; } case DIALOG_ID_HIGH_SCORES_LOCAL_SHOW: { final DialogHighScoresLocalShowListener DIALOG_LISTENER_HIGH_SCORES_SHOW = new DialogHighScoresLocalShowListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("blank"); builder.setTitle(R.string.ws_LOCAL_HIGH_SCORES); builder.setNegativeButton(R.string.ws_reset, DIALOG_LISTENER_HIGH_SCORES_SHOW); builder.setNeutralButton(android.R.string.ok, DIALOG_LISTENER_HIGH_SCORES_SHOW); builder.setPositiveButton(R.string.ws_GLOBAL, DIALOG_LISTENER_HIGH_SCORES_SHOW); dialog = builder.create(); break; } case DIALOG_ID_GAME_NEW: { final DialogGameNewListener DIALOG_LISTENER_GAME_NEW = new DialogGameNewListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(this.getString(R.string.ws_game_over)); builder.setPositiveButton(R.string.ws_new_game, DIALOG_LISTENER_GAME_NEW); builder.setNeutralButton(R.string.ws_REPLAY, DIALOG_LISTENER_GAME_NEW); builder.setNegativeButton(android.R.string.cancel, DIALOG_LISTENER_GAME_NEW); dialog = builder.create(); break; } case DIALOG_ID_INTRO_INPUT_TYPE: { final DialogIntroListener DIALOG_LISTENER_INTRO = new DialogIntroListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.ws_INTRO); builder.setPositiveButton(R.string.ws_tap, DIALOG_LISTENER_INTRO); builder.setNeutralButton(android.R.string.cancel, DIALOG_LISTENER_INTRO); builder.setNegativeButton(R.string.ws_drag, DIALOG_LISTENER_INTRO); dialog = builder.create(); break; } case DIALOG_ID_INTRO_DONATE: { final DialogInterface.OnClickListener LISTENER = new DialogIntroDonateListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.ws_INTRO_DONATE_MSG); builder.setPositiveButton(R.string.ws_DONATE, LISTENER); builder.setNegativeButton(R.string.ws_DONATE_NO, LISTENER); dialog = builder.create(); break; } case DIALOG_ID_DONATE: { final DialogInterface.OnClickListener LISTENER = new DialogDonateListener(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.ws_DONATE_MSG); builder.setPositiveButton(R.string.ws_DONATE_MARKET, LISTENER); builder.setNeutralButton(R.string.ws_DONATE_WEB, LISTENER); builder.setNegativeButton(R.string.ws_DONATE_NO, LISTENER); dialog = builder.create(); break; } default: dialog = super.onCreateDialog(id); break; } return dialog; }
From source file:net.evecom.androidecssp.base.BaseActivity.java
/** * //from w ww . jav a 2s. c om * * @param errorMsg */ protected void dialogPickToast(String title, String msg, String ymsg, String nmsg, final IPickCallback callback) { AlertDialog.Builder builder1 = new AlertDialog.Builder(this); builder1.setTitle(title); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage(msg); builder1.setPositiveButton(ymsg, new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { if (null != callback) { callback.yes(); } } }); builder1.setNegativeButton(nmsg, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { callback.no(); } }); builder1.show(); }
From source file:org.kde.necessitas.ministro.MinistroActivity.java
private boolean checkFreeSpace(final long size) throws InterruptedException { final StatFs stat = new StatFs(m_qtLibsRootPath); if (stat.getBlockSize() * stat.getAvailableBlocks() < size) { runOnUiThread(new Runnable() { public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(MinistroActivity.this); builder.setMessage(getResources().getString(R.string.ministro_disk_space_msg, (size - (stat.getBlockSize() * stat.getAvailableBlocks())) / 1024 + "Kb")); builder.setCancelable(true); builder.setNeutralButton(getResources().getString(R.string.settings_msg), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { try { startActivityForResult( new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS), freeSpaceCode); } catch (Exception e) { e.printStackTrace(); try { startActivityForResult( new Intent(Settings.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS), freeSpaceCode); } catch (Exception e1) { e1.printStackTrace(); }/* w w w . j a va2s. c o m*/ } } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); m_diskSpaceSemaphore.release(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { dialog.dismiss(); m_diskSpaceSemaphore.release(); } }); m_distSpaceDialog = builder.create(); m_distSpaceDialog.show(); } }); m_diskSpaceSemaphore.acquire(); } else return true; return stat.getBlockSize() * stat.getAvailableBlocks() > size; }
From source file:org.kde.necessitas.ministro.MinistroActivity.java
private void checkNetworkAndDownload(final boolean update) { if (isOnline(this)) new CheckLibraries().execute(update); else {//from ww w . j a va2 s . c o m AlertDialog.Builder builder = new AlertDialog.Builder(MinistroActivity.this); builder.setMessage(getResources().getString(R.string.ministro_network_access_msg)); builder.setCancelable(true); builder.setNeutralButton(getResources().getString(R.string.settings_msg), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { final ProgressDialog m_dialog = ProgressDialog.show(MinistroActivity.this, null, getResources().getString(R.string.wait_for_network_connection_msg), true, true, new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { finishMe(); } }); getApplication().registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (isOnline(MinistroActivity.this)) { try { getApplication().unregisterReceiver(this); } catch (Exception e) { e.printStackTrace(); } runOnUiThread(new Runnable() { public void run() { m_dialog.dismiss(); new CheckLibraries().execute(update); } }); } } }, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); try { startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } catch (Exception e) { e.printStackTrace(); try { startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); } catch (Exception e1) { e1.printStackTrace(); } } dialog.dismiss(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { finishMe(); } }); AlertDialog alert = builder.create(); alert.show(); } }
From source file:pl.bcichecki.rms.client.android.activities.LoginActivity.java
protected void performLogin() { Log.d(TAG, "Performing login... [username=" + username + ", password=" + password + "]"); profileRestClient = new ProfileRestClient(CONTEXT, username, password, SharedPreferencesWrapper.getServerRealm(), SharedPreferencesWrapper.getServerAddress(), SharedPreferencesWrapper.getServerPort(), SharedPreferencesWrapper.getWebserviceContextPath()); profileRestClient.getProfile(new GsonHttpResponseHandler<User>(new TypeToken<User>() { }.getType(), true) {//from w w w. ja va 2s .co m @Override public void onFailure(Throwable error, String content) { Log.d(TAG, "Getting profile failed! [error=" + error + ", content=" + content + "]"); AlertDialog.Builder errorDialog = new AlertDialog.Builder(CONTEXT); errorDialog.setIcon(android.R.drawable.ic_dialog_alert); if (error instanceof HttpResponseException) { if (((HttpResponseException) error).getStatusCode() == HttpStatus.SC_UNAUTHORIZED) { errorDialog.setTitle(R.string.activity_login_unsuccessful_login_message_title); errorDialog.setMessage(R.string.activity_login_unsuccessful_login_message_content); } else { errorDialog.setTitle(R.string.general_unknown_error_message_title); errorDialog .setMessage(String.format(getString(R.string.general_unknown_error_message_content), (HttpResponseException) error)); } } else { errorDialog.setTitle(R.string.general_unknown_error_message_title); errorDialog.setMessage( String.format(getString(R.string.general_unknown_error_message_content), error)); } errorDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog = errorDialog.show(); TextView messageText = (TextView) dialog.findViewById(android.R.id.message); messageText.setGravity(Gravity.CENTER); } @Override public void onFinish() { showProgress(false); Log.d(TAG, "Getting profile finished."); } @Override public void onStart() { Log.d(TAG, "Getting profile started."); showProgress(true); } @Override public void onSuccess(int statusCode, User user) { Log.d(TAG, "Success [statusCode=" + statusCode + ", jsonObject=" + user.toString() + "]"); UserProfileHolder.setUserProfile(user); UserProfileHolder.setUsername(username); UserProfileHolder.setPassword(password); AppUtils.showCenteredToast(CONTEXT, R.string.activity_login_login_successful, Toast.LENGTH_SHORT); Intent mainActivityIntent = new Intent(CONTEXT, MainActivity.class); startActivity(mainActivityIntent); } }); }
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);/* ww w.j a v a 2 s .c o m*/ // 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) { } }); }