List of usage examples for android.app AlertDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:org.adawaycn.ui.RedirectionListFragment.java
/** * Add new entry based on input// w w w . ja va 2s . co m * * @param input */ private void addEntry(String hostname, String ip) { if (hostname != null) { if (org.adawaycn.util.RegexUtils.isValidHostname(hostname)) { if (org.adawaycn.util.RegexUtils.isValidIP(ip)) { org.adawaycn.provider.ProviderHelper.insertRedirectionListItem(mActivity, hostname, ip); } else { AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create(); alertDialog.setIcon(android.R.drawable.ic_dialog_alert); alertDialog.setTitle(R.string.no_ip_title); alertDialog.setMessage(getString(R.string.no_ip)); alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sum) { dlg.dismiss(); } }); alertDialog.show(); } } else { AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create(); alertDialog.setIcon(android.R.drawable.ic_dialog_alert); alertDialog.setTitle(R.string.no_hostname_title); alertDialog.setMessage(getString(R.string.no_hostname)); alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sum) { dlg.dismiss(); } }); alertDialog.show(); } } }
From source file:cm.aptoide.pt.RemoteInSearch.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case MANAGE_REPO: Intent i = new Intent(this, ManageRepo.class); startActivity(i);// w w w . ja v a 2 s. c om return true; case SEARCH_MENU: onSearchRequested(); return true; case ABOUT: LayoutInflater li = LayoutInflater.from(this); View view = li.inflate(R.layout.about, null); Builder p = new AlertDialog.Builder(this).setView(view); final AlertDialog alrt = p.create(); alrt.setIcon(R.drawable.icon); alrt.setTitle("APTOIDE"); alrt.setButton("ChangeLog", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Uri uri = Uri.parse("http://aptoide.com/changelog.html"); startActivity(new Intent(Intent.ACTION_VIEW, uri)); } }); alrt.show(); return true; case SETTINGS: Intent s = new Intent(RemoteInSearch.this, Settings.class); s.putExtra("order", order_lst); startActivityForResult(s, SETTINGS_FLAG); } return super.onOptionsItemSelected(item); }
From source file:org.epstudios.epcoding.ProcedureDetailFragment.java
public void saveCoding() { // don't bother if no secondary codes to save if (secondaryCheckBoxMap.isEmpty()) { Toast toast = Toast.makeText(context, getString(R.string.no_secondary_codes_error_message), Toast.LENGTH_SHORT);//from w w w . j a v a 2 s .c o m toast.show(); return; } AlertDialog dialog = new AlertDialog.Builder(context).create(); String message = "Save these selections as a default?"; dialog.setMessage(message); dialog.setTitle("Save Defaults"); dialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { save(); } }); dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); dialog.show(); }
From source file:sssemil.com.hostsaway.ui.HostsSourcesFragment.java
/** * Edit entry based on selection in context menu * * @param info/* www . j a va2 s . c om*/ */ private void menuEditEntry(AdapterContextMenuInfo info) { mCurrentRowId = info.id; // set global RowId to row id from cursor to use inside save button int position = info.position; View v = info.targetView; TextView urlTextView = (TextView) v.findViewWithTag("url_" + position); AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); builder.setCancelable(true); builder.setTitle(getString(R.string.checkbox_list_edit_dialog_title)); // build view from layout LayoutInflater factory = LayoutInflater.from(mActivity); final View dialogView = factory.inflate(R.layout.lists_url_dialog, null); final EditText inputEditText = (EditText) dialogView.findViewById(R.id.list_dialog_url); // set text from list inputEditText.setText(urlTextView.getText()); inputEditText.setInputType(InputType.TYPE_TEXT_VARIATION_URI); // move cursor to end of EditText Editable inputEditContent = inputEditText.getText(); inputEditText.setSelection(inputEditContent.length()); builder.setView(dialogView); builder.setPositiveButton(getResources().getString(R.string.button_save), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); String input = inputEditText.getText().toString(); if (RegexUtils.isValidUrl(input)) { // update in db ProviderHelper.updateHostsSourceUrl(mActivity, mCurrentRowId, input); } else { AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create(); alertDialog.setIcon(android.R.drawable.ic_dialog_alert); alertDialog.setTitle(R.string.no_url_title); alertDialog.setMessage(getString(sssemil.com.hostsaway.R.string.no_url)); alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sum) { dlg.dismiss(); } }); alertDialog.show(); } } }); builder.setNegativeButton(getResources().getString(R.string.button_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:org.adaway.ui.HostsSourcesFragment.java
/** * Edit entry based on selection in context menu * * @param info// www .j a v a2 s .c o m */ private void menuEditEntry(AdapterContextMenuInfo info) { mCurrentRowId = info.id; // set global RowId to row id from cursor to use inside save button int position = info.position; View v = info.targetView; TextView urlTextView = (TextView) v.findViewWithTag("url_" + position); AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); builder.setCancelable(true); builder.setTitle(getString(R.string.checkbox_list_edit_dialog_title)); // build view from layout LayoutInflater factory = LayoutInflater.from(mActivity); final View dialogView = factory.inflate(R.layout.lists_url_dialog, null); final EditText inputEditText = (EditText) dialogView.findViewById(R.id.list_dialog_url); // set text from list inputEditText.setText(urlTextView.getText()); inputEditText.setInputType(InputType.TYPE_TEXT_VARIATION_URI); // move cursor to end of EditText Editable inputEditContent = inputEditText.getText(); inputEditText.setSelection(inputEditContent.length()); builder.setView(dialogView); builder.setPositiveButton(getResources().getString(R.string.button_save), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); String input = inputEditText.getText().toString(); if (RegexUtils.isValidUrl(input)) { // update in db ProviderHelper.updateHostsSourceUrl(mActivity, mCurrentRowId, input); } else { AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create(); alertDialog.setIcon(android.R.drawable.ic_dialog_alert); alertDialog.setTitle(R.string.no_url_title); alertDialog.setMessage(getString(org.adaway.R.string.no_url)); alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sum) { dlg.dismiss(); } }); alertDialog.show(); } } }); builder.setNegativeButton(getResources().getString(R.string.button_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:org.adawaycn.ui.HostsSourcesFragment.java
/** * Edit entry based on selection in context menu * * @param info/* ww w .j av a 2 s . com*/ */ private void menuEditEntry(AdapterContextMenuInfo info) { mCurrentRowId = info.id; // set global RowId to row id from cursor to use inside save button int position = info.position; View v = info.targetView; TextView urlTextView = (TextView) v.findViewWithTag("url_" + position); AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); builder.setCancelable(true); builder.setTitle(getString(R.string.checkbox_list_edit_dialog_title)); // build view from layout LayoutInflater factory = LayoutInflater.from(mActivity); final View dialogView = factory.inflate(R.layout.lists_url_dialog, null); final EditText inputEditText = (EditText) dialogView.findViewById(R.id.list_dialog_url); // set text from list inputEditText.setText(urlTextView.getText()); inputEditText.setInputType(InputType.TYPE_TEXT_VARIATION_URI); // move cursor to end of EditText Editable inputEditContent = inputEditText.getText(); inputEditText.setSelection(inputEditContent.length()); builder.setView(dialogView); builder.setPositiveButton(getResources().getString(R.string.button_save), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); String input = inputEditText.getText().toString(); if (RegexUtils.isValidUrl(input)) { // update in db ProviderHelper.updateHostsSourceUrl(mActivity, mCurrentRowId, input); } else { AlertDialog alertDialog = new AlertDialog.Builder(mActivity).create(); alertDialog.setIcon(android.R.drawable.ic_dialog_alert); alertDialog.setTitle(R.string.no_url_title); alertDialog.setMessage(getString(R.string.no_url)); alertDialog.setButton(getString(R.string.button_close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sum) { dlg.dismiss(); } }); alertDialog.show(); } } }); builder.setNegativeButton(getResources().getString(R.string.button_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.aknowledge.v1.automation.RemoteActivity.java
public void onDevicesLoaded(String result) { Log.d("RemoteActivity", "devices loaded: " + result); if (dialog != null && dialog.isShowing()) { dialog.dismiss();//w ww . j a va 2 s.c o m } if (result != null) { parseMyDevices(result); createRemotePanel(); } else { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Problems with your server info."); alertDialog.setMessage("You should check your settings and try again."); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); // Set the Icon for the Dialog alertDialog.show(); } }
From source file:no.ntnu.idi.socialhitchhiking.Main.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try {// ww w . ja va2 s .c om initLoadingScreen(); new Thread() { public void run() { setConnection(Main.this); user = getApp().getUser(); if (user == null) { loginButtonClicked(); } else { initMainScreen(); if (!isSession()) { resetSession(); } } } }.start(); } catch (Exception e) { AlertDialog ad = new AlertDialog.Builder(Main.this).create(); ad.setTitle("Server error"); ad.setMessage( "The server is not responding.. Please try again later or contact the system administrator."); ad.setButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); System.exit(0); } }); ad.show(); } }
From source file:com.teamproject.shoutbox.MainActivity.java
public void showAlertDialog() { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); // Setting Dialog Title alertDialog.setTitle("ShoutBox"); // String s= (Html.fromHtml("<a href=\"http://www.google.com\">Check this link out</a>")).toString(); // Setting Dialog Message alertDialog.setMessage(//ww w.ja va 2 s . co m "No abusive/offensive words please. You'll unnecessarily increase your chances of getting banned!"); // Setting Icon to Dialog alertDialog.setIcon(R.drawable.icon); // Setting OK Button alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to execute after dialog closed //Toast.makeText(getApplicationContext(), "You clicked on OK", Toast.LENGTH_SHORT).show(); } }); // Showing Alert Message alertDialog.show(); }
From source file:com.LMO.capstone.KnoWITHerbalMain.java
private void resolver() throws XmlPullParserException, IOException { if (!new File(Config.dbPath(getApplicationContext())).exists()) { //no DB, no Folder HowToUseFragment howto = new HowToUseFragment(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.frame_content, howto); ft.addToBackStack("help"); ft.commit();//from ww w. ja v a 2 s . c o m if (util.isNetworkAvailable()) util.PrepareFileForDatabase(); } else { File appDir = new File(Config.externalDirectory); if (!appDir.exists()) appDir.mkdir(); FileFilter filter = new FileFilter() { @Override public boolean accept(File pathname) { // TODO Auto-generated method stub return pathname.toString().toLowerCase(Locale.getDefault()).contains(".jpg") || pathname.toString().toLowerCase(Locale.getDefault()).contains(".png") || pathname.toString().toLowerCase(Locale.getDefault()).contains(".bmp") || pathname.toString().toLowerCase(Locale.getDefault()).contains(".gif") || pathname.toString().toLowerCase(Locale.getDefault()).contains(".jpeg"); } }; File[] files = appDir.listFiles(filter); dbHelper = new DatabaseHelper(this); int imageEntryCount = Queries.getImageEntryCount(sqliteDB, dbHelper); if (files.length == 1 || (files.length + 1) < imageEntryCount) { AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog dialog = builder.create(); dialog.setTitle("Oops!"); dialog.setMessage("It seems your data is invalid!\nRe-download now?"); dialog.setButton(AlertDialog.BUTTON_POSITIVE, "Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub if (util.isNetworkAvailable()) Queries.truncateDatabase(sqliteDB, dbHelper, getApplicationContext()); util.PrepareFileForDatabase(); } }); dialog.setButton(AlertDialog.BUTTON_NEGATIVE, "Maybe later", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.dismiss(); } }); dialog.show(); } } }