List of usage examples for android.app AlertDialog setMessage
public void setMessage(CharSequence message)
From source file:com.aikidonord.fragments.FragmentType.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_type, null /*container, false*/); View rlLoading = view.findViewById(R.id.loadingPanel); //View listView = view.getListView(); if (VerifConnexion.isOnline(this.getActivity())) { rlLoading.setVisibility(View.VISIBLE); // on va fair l'impasse l dessus vu que je ne suis pas bien sr // de la manire dont il faut oprer tant que la vue n'a pas t renvoye. //listView.setVisibility(View.GONE); this.lancementAsync(); } else {//from ww w . j av a2s . c o m AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create(); alertDialog.setTitle(getResources().getString(R.string.app_name)); alertDialog.setMessage(getResources().getString(R.string.no_network)); alertDialog.setIcon(R.drawable.ic_launcher); alertDialog.setCancelable(false); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // if this button is clicked, close // current activity FragmentType.this.getActivity().finish(); } }); alertDialog.show(); } return view; }
From source file:dk.kasperbaago.JSONHandler.JSONHandler.java
/** * Shows an error to the user, if the request fails. * Callback is NOT called if this is shown. To still run callback and use your own error handler, use showErrMsg(false); *//* w w w . j a v a2 s . c o m*/ private void showErrorMsg() { AlertDialog alert = new AlertDialog.Builder(this.context).create(); alert.setTitle(this.errorMsgTitle); alert.setMessage(this.errorMsgTxt); alert.setButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); }
From source file:com.deemsys.lmsmooc.BillingFragment.java
@SuppressWarnings("deprecation") @Override/*from w ww . j av a2 s .c om*/ public void onResume() { super.onResume(); if (isInternetPresent) { // onResume(); new Details().execute(); } else { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setTitle("Sorry User"); alertDialog.setMessage("No network connection."); alertDialog.setIcon(R.drawable.delete); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int which) { } }); alertDialog.show(); } }
From source file:com.unicamp.br.mo409.controller.MainActivity.java
private void showPopUpMessage(String message) { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setMessage(message); alertDialog.show();/*w ww . j a va2 s . co m*/ }
From source file:com.prof.youtubeparser.example.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { android.support.v7.app.AlertDialog alertDialog = new android.support.v7.app.AlertDialog.Builder( MainActivity.this).create(); alertDialog.setTitle(R.string.app_name); alertDialog.setMessage(Html.fromHtml(MainActivity.this.getString(R.string.info_text) + " <a href='http://github.com/prof18/YoutubeParser'>GitHub.</a>" + MainActivity.this.getString(R.string.author))); alertDialog.setButton(android.support.v7.app.AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); }/*w ww . j a va 2 s . c o m*/ }); alertDialog.show(); ((TextView) alertDialog.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } return super.onOptionsItemSelected(item); }
From source file:org.jonblack.bluetrack.activities.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); // Load default preference values. // The defaults are only loaded if they haven't been done before. It will // not overwrite changes. // @see PreferenceManager.setDefaultValues PreferenceManager.setDefaultValues(this, R.xml.preferences, false); // Get the local bluetooth adapter and check if bluetooth is supported. BluetoothAdapter localBtAdapter = BluetoothAdapter.getDefaultAdapter(); if (localBtAdapter == null) { Log.w(TAG, "Bluetooth isn't supported on device."); AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false);//w w w . jav a2 s. c om Resources r = getResources(); String msg = r.getString(R.string.error_bluetooth_not_supported, r.getString(R.string.app_name)); ad.setMessage(msg); ad.setButton(AlertDialog.BUTTON_POSITIVE, r.getString(R.string.button_exit), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); dialog.dismiss(); } }); ad.show(); return; } Resources r = getResources(); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.Tab tab1 = actionBar.newTab().setText(r.getText(R.string.ab_tab_live_tracking)); tab1.setTag("tracking"); tab1.setTabListener(new TabListener<LiveTrackingFragment>(this, "tracking", LiveTrackingFragment.class)); actionBar.addTab(tab1); ActionBar.Tab tab2 = actionBar.newTab().setText(r.getText(R.string.ab_tab_sessions)); tab2.setTag("session"); tab2.setTabListener(new TabListener<SessionFragment>(this, "session", SessionFragment.class)); actionBar.addTab(tab2); ActionBar.Tab tab3 = actionBar.newTab().setText(r.getText(R.string.ab_tab_devices)); tab3.setTag("devices"); tab3.setTabListener(new TabListener<DevicesFragment>(this, "devices", DevicesFragment.class)); actionBar.addTab(tab3); }
From source file:com.google.android.demos.atom.app.FeedActivity.java
@Override protected void onPrepareDialog(int id, Dialog dialog) { super.onPrepareDialog(id, dialog); if (id == DIALOG_INVALID_URL) { AlertDialog d = (AlertDialog) dialog; String template = getString(R.string.atom_error_invalid_url); CharSequence message = MessageFormat.format(template, mInvalidUrl); d.setMessage(message); }/* www . ja va2 s.com*/ }
From source file:com.ubundude.timesheet.MainActivity.java
/** * Checks for an updated version of the app * * If there is an updated version, an Alert dialog is displayed * to advise the user to download the latest version * * @throws NameNotFoundException//from www .ja v a2 s . c o m * @throws IOException * @throws InterruptedException * @throws ExecutionException */ @SuppressWarnings("deprecation") private void updateCheck() throws NameNotFoundException, IOException, InterruptedException, ExecutionException { /** String to store the version from the url */ String urlVersion; /** Get instance of UpdateCheck.java and get the version returned from it */ UpdateCheck check = new UpdateCheck(); urlVersion = check.execute().get(); /** Get the currently running version of the app for comparision */ PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); String packageVersion = pInfo.versionName; Log.d("Package Version", packageVersion); /** Builds an alert dialog to let the user know that they need to upgrade */ if (!urlVersion.equals(packageVersion)) { AlertDialog alert = new AlertDialog.Builder(this).create(); alert.setTitle("Version Check"); alert.setMessage("You're version is out of date. Please visit " + "www.ubundude.com/p/beta.html to update to the latest version."); alert.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alert.show(); } }
From source file:com.ceino.chaperonandroid.activities.LicenseActivity.java
public void showAlertDialog(Activity context, String title, String message, Boolean status) { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); // Setting Dialog Title alertDialog.setTitle(title);/*from w w w .ja va2s. co m*/ // Setting Dialog Message alertDialog.setMessage(message); // Setting alert dialog icon alertDialog.setIcon((status) ? R.drawable.ic_launcher : R.drawable.ic_launcher); // Setting OK Button alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); // Showing Alert Message alertDialog.show(); }
From source file:fr.android.earthdawn.activities.CharacterSheetActivity.java
@Override protected void onPrepareDialog(final int id, final Dialog dialog, final Bundle args) { final AlertDialog alert = (AlertDialog) dialog; switch (id) { case Constants.DIALOG_SHOW_DETAILS: alert.setTitle(getString(R.string.roller_popup_title2, getString(EDDicesLauncher.getRollType()))); alert.setMessage(EDDicesLauncher.getDetailedMessage(this)); break;//from w w w. j a v a 2 s .c o m case Constants.DIALOG_SHOW_DAMAGES_TAKEN: alert.setTitle(R.string.popup_damages_taken_title); alert.setMessage(getString(R.string.popup_damages_taken_msg, args.getCharSequence(Constants.BUNDLE_DMG_TAKEN_ARM), Integer.toString(args.getInt(Constants.BUNDLE_DMG_TAKEN_PV)), Integer.toString(args.getInt(Constants.BUNDLE_DMG_TAKEN_WOUND)))); break; default: break; } super.onPrepareDialog(id, dialog, args); }