List of usage examples for android.app AlertDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:cm.aptoide.pt.RemoteInTab.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case UPDATE_REPO: final AlertDialog upd_alrt = new AlertDialog.Builder(this).create(); if (!db.areServers()) { upd_alrt.setIcon(android.R.drawable.ic_dialog_alert); upd_alrt.setTitle("Empty"); upd_alrt.setMessage(//from www . j av a 2 s. c om "There are no enabled repositories in your list.\nPlease add repository or enable the ones you have!"); upd_alrt.setButton("Ok", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); } else { upd_alrt.setIcon(android.R.drawable.ic_dialog_alert); upd_alrt.setTitle("Update repositories"); upd_alrt.setMessage( "Do you wish to update repositories?\nThis can take a while (WiFi is advised)..."); upd_alrt.setButton("Yes", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { updateRepos(); } }); upd_alrt.setButton2("No", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { upd_alrt.dismiss(); } }); } upd_alrt.show(); return true; case MANAGE_REPO: Intent i = new Intent(this, ManageRepo.class); startActivityForResult(i, NEWREPO_FLAG); 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(RemoteInTab.this, Settings.class); s.putExtra("order", order_lst); startActivityForResult(s, SETTINGS_FLAG); } return super.onOptionsItemSelected(item); }
From source file:no.digipost.android.gui.content.ThreadPerTaskExecutor.java
/** * Called when the activity is first created. *///from w w w . j av a 2 s . co m @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pdf); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); toolbar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showInformationDialog(); } }); ((DigipostApplication) getApplication()).getTracker(DigipostApplication.TrackerName.APP_TRACKER); selectActionModeCallback = new SelectActionModeCallback(); mAlertBuilder = new AlertDialog.Builder(this); intent = getIntent(); String openFilepath = intent.getStringExtra(ACTION_OPEN_FILEPATH); if (openFilepath != null) { setActionBar(FilenameUtils.getName(openFilepath)); core = openFile(openFilepath); SearchTaskResult.set(null); } else if (core == null && DocumentContentStore.getDocumentContent() != null) { setActionBar(DocumentContentStore.getDocumentAttachment().getSubject()); byte buffer[] = DocumentContentStore.getDocumentContent(); if (buffer != null) { core = openBuffer(buffer); } SearchTaskResult.set(null); } if (core == null) { AlertDialog alert = mAlertBuilder.create(); alert.setTitle(R.string.pdf_open_failed); alert.setButton(AlertDialog.BUTTON_POSITIVE, this.getString(R.string.close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }); alert.show(); return; } createUI(); if (savedInstanceState != null) { mDocView.setDisplayedViewIndex(savedInstanceState.getInt(CURRENT_WINDOW, 0)); } if (super.shouldShowInvoiceOptionsDialog(this)) { super.showInvoiceOptionsDialog(this); } super.showMetadata(); }
From source file:com.google.appinventor.components.runtime.FusiontablesControl.java
private void showNoticeAndDie(String message, String title, String buttonText) { AlertDialog alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle(title); // prevents the user from escaping the dialog by hitting the Back button alertDialog.setCancelable(false);/*w w w . j a va 2s . c o m*/ alertDialog.setMessage(message); alertDialog.setButton(buttonText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { activity.finish(); } }); alertDialog.show(); }
From source file:com.swetha.easypark.GetIndividualParkingSpotDetails.java
public void updateListView(ArrayList<LinkedHashMap<String, String>> parkingSpotMapList, int success) { if (success == 1) { mSelectedItem = 0;/* w ww .ja v a 2 s .co m*/ for (int i = 0; i < parkingSpotMapList.size(); i++) { Log.i("GetIndividualParkingSpotDetails", "Inside For loop"); RadioButtonTracker l_ts; LinkedHashMap<String, String> map = parkingSpotMapList.get(i); Log.i("GetIndividualParkingSpotDetails", "Value in map is " + map.get("vacantspotdisplay")); Log.i("GetIndividualParkingSpotDetails", "parking spoid is is " + map.get("parkingspotid")); if (i == mSelectedItem) { Log.i("GetIndividualParkingSpotDetails", "Before calling RadioButtonTracker constructor - if"); l_ts = new RadioButtonTracker(map, true); Log.i("GetIndividualParkingSpotDetails", "After calling RadioButtonTracker constructor-if"); } else { l_ts = new RadioButtonTracker(map, false); } mSelectionList.add(l_ts); } Log.i("GetIndividualParkingSpotDetails", "After -if-else condition"); adapter = new RadioButtonTrackerListAdapter(mContext); adapter.setListItems(mSelectionList); Log.i("GetIndividualParkingSpotDetails", "After setListItems"); this.setListAdapter(adapter); Log.i("GetIndividualParkingSpotDetails", "After setListAdapter"); } else { AlertDialog alertDialog = new AlertDialog.Builder(GetIndividualParkingSpotDetails.this).create(); // Setting Dialog Title alertDialog.setTitle("Sorry!"); // Setting Dialog Message alertDialog.setMessage("No Parking spots found"); // Setting Icon to Dialog // alertDialog.setIcon(R.drawable.tick); // 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 Intent intent = new Intent(GetIndividualParkingSpotDetails.this, GetParkingLots.class); startActivity(intent); } }); // Showing Alert Message alertDialog.show(); } }
From source file:com.glm.trainer.NewMainActivity.java
@Override public void onBackPressed() { AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(this.getString(R.string.titleendapp)); alertDialog.setMessage(this.getString(R.string.messageendapp)); alertDialog.setButton(this.getString(R.string.yes), new android.content.DialogInterface.OnClickListener() { @Override// w w w.j av a 2s . c om public void onClick(DialogInterface arg0, int arg1) { if (mConnection != null && mConnection.mIService != null) { try { mConnection.mIService.stopGPSFix(); mConnection.mIService.shutDown(); mConnection.destroy(); } catch (RemoteException e) { // TODO Auto-generated catch block //Log.e(this.getClass().getCanonicalName(),e.getMessage()); } } finish(); } }); alertDialog.setButton2(this.getString(R.string.no), new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); alertDialog.show(); }
From source file:no.barentswatch.fiskinfo.MapActivity.java
public void showProximityAlertDialog(Context activityContext) { LayoutInflater layoutInflater = getLayoutInflater(); View view = layoutInflater.inflate(R.layout.dialog_proximity_alert, null); final AlertDialog builder = new AlertDialog.Builder(activityContext).create(); builder.setTitle(R.string.map_proximity_alert_title); builder.setView(view);//from w w w.j a va2s . co m Button goToMyPositionButton = (Button) view.findViewById(R.id.proximityAlertViewPositionButton); Button cancelProximityAlert = (Button) view.findViewById(R.id.proximityAlertCancelButton); builder.setView(view); goToMyPositionButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { builder.dismiss(); browser.loadUrl("javascript:zoomToUserPosition()"); } }); cancelProximityAlert.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO: stop alert builder.dismiss(); } }); builder.show(); }
From source file:ch.bfh.instacircle.NetworkActiveActivity.java
/** * Writes an NFC Tag/* w ww . j a v a 2s . com*/ * * @param tag * The reference to the tag * @param message * the message which should be writen on the message * @return true if successful, false otherwise */ public boolean writeTag(Tag tag, NdefMessage message) { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("InstaCircle - write NFC Tag failed"); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); try { // see if tag is already NDEF formatted Ndef ndef = Ndef.get(tag); if (ndef != null) { ndef.connect(); if (!ndef.isWritable()) { Log.d(TAG, "This tag is read only."); alertDialog.setMessage("This tag is read only."); alertDialog.show(); return false; } // work out how much space we need for the data int size = message.toByteArray().length; if (ndef.getMaxSize() < size) { Log.d(TAG, "Tag doesn't have enough free space."); alertDialog.setMessage("Tag doesn't have enough free space."); alertDialog.show(); return false; } ndef.writeNdefMessage(message); Log.d(TAG, "Tag written successfully."); } else { // attempt to format tag NdefFormatable format = NdefFormatable.get(tag); if (format != null) { try { format.connect(); format.format(message); Log.d(TAG, "Tag written successfully!"); } catch (IOException e) { alertDialog.setMessage("Unable to format tag to NDEF."); alertDialog.show(); Log.d(TAG, "Unable to format tag to NDEF."); return false; } } else { Log.d(TAG, "Tag doesn't appear to support NDEF format."); alertDialog.setMessage("Tag doesn't appear to support NDEF format."); alertDialog.show(); return false; } } } catch (Exception e) { Log.d(TAG, "Failed to write tag"); return false; } alertDialog.setTitle("InstaCircle"); alertDialog.setMessage("NFC Tag written successfully."); alertDialog.show(); return true; }
From source file:cm.aptoide.pt.ScheduledDownloads.java
private void continueLoading() { lv = (ListView) findViewById(android.R.id.list); db = Database.getInstance();/*from w w w .j av a 2 s.c o m*/ adapter = new CursorAdapter(this, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER) { @Override public View newView(Context context, Cursor arg1, ViewGroup arg2) { return LayoutInflater.from(context).inflate(R.layout.row_sch_download, null); } @Override public void bindView(View convertView, Context arg1, Cursor c) { // Planet to display ScheduledDownload scheduledDownload = scheduledDownloadsHashMap.get(c.getString(0)); // The child views in each row. CheckBox checkBoxScheduled; TextView textViewName; TextView textViewVersion; ImageView imageViewIcon; // Create a new row view if (convertView.getTag() == null) { // Find the child views. textViewName = (TextView) convertView.findViewById(R.id.name); textViewVersion = (TextView) convertView.findViewById(R.id.appversion); checkBoxScheduled = (CheckBox) convertView.findViewById(R.id.schDwnChkBox); imageViewIcon = (ImageView) convertView.findViewById(R.id.appicon); // Optimization: Tag the row with it's child views, so we don't have to // call findViewById() later when we reuse the row. convertView.setTag(new Holder(textViewName, textViewVersion, checkBoxScheduled, imageViewIcon)); // If CheckBox is toggled, update the planet it is tagged with. checkBoxScheduled.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { CheckBox cb = (CheckBox) v; ScheduledDownload schDownload = (ScheduledDownload) cb.getTag(); schDownload.setChecked(cb.isChecked()); } }); } // Reuse existing row view else { // Because we use a ViewHolder, we avoid having to call findViewById(). Holder viewHolder = (Holder) convertView.getTag(); checkBoxScheduled = viewHolder.checkBoxScheduled; textViewVersion = viewHolder.textViewVersion; textViewName = viewHolder.textViewName; imageViewIcon = viewHolder.imageViewIcon; } // Tag the CheckBox with the Planet it is displaying, so that we can // access the planet in onClick() when the CheckBox is toggled. checkBoxScheduled.setTag(scheduledDownload); // Display planet data checkBoxScheduled.setChecked(scheduledDownload.isChecked()); textViewName.setText(scheduledDownload.getName()); textViewVersion.setText(scheduledDownload.getVername()); // Tag the CheckBox with the Planet it is displaying, so that we can // access the planet in onClick() when the CheckBox is toggled. checkBoxScheduled.setTag(scheduledDownload); // Display planet data checkBoxScheduled.setChecked(scheduledDownload.isChecked()); textViewName.setText(scheduledDownload.getName()); textViewVersion.setText("" + scheduledDownload.getVername()); ImageLoader.getInstance().displayImage(scheduledDownload.getIconPath(), imageViewIcon); } }; lv.setAdapter(adapter); getSupportLoaderManager().initLoader(0, null, this); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View item, int arg2, long arg3) { ScheduledDownload scheduledDownload = (ScheduledDownload) ((Holder) item.getTag()).checkBoxScheduled .getTag(); scheduledDownload.toggleChecked(); Holder viewHolder = (Holder) item.getTag(); viewHolder.checkBoxScheduled.setChecked(scheduledDownload.isChecked()); } }); IntentFilter filter = new IntentFilter("pt.caixamagica.aptoide.REDRAW"); registerReceiver(receiver, filter); Button installButton = (Button) findViewById(R.id.sch_down); // installButton.setText(getText(R.string.schDown_installselected)); installButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (isAllChecked()) { for (String scheduledDownload : scheduledDownloadsHashMap.keySet()) { if (scheduledDownloadsHashMap.get(scheduledDownload).checked) { ScheduledDownload schDown = scheduledDownloadsHashMap.get(scheduledDownload); ViewApk apk = new ViewApk(); apk.setApkid(schDown.getApkid()); apk.setName(schDown.getName()); apk.setVercode(schDown.getVercode()); apk.setIconPath(schDown.getIconPath()); apk.setVername(schDown.getVername()); apk.setRepoName(schDown.getRepoName()); serviceDownloadManager .startDownloadWithWebservice(serviceDownloadManager.getDownload(apk), apk); Toast toast = Toast.makeText(ScheduledDownloads.this, R.string.starting_download, Toast.LENGTH_SHORT); toast.show(); } } } else { Toast toast = Toast.makeText(ScheduledDownloads.this, R.string.schDown_nodownloadselect, Toast.LENGTH_SHORT); toast.show(); } } }); if (getIntent().hasExtra("downloadAll")) { Builder dialogBuilder = new AlertDialog.Builder(this); final AlertDialog scheduleDownloadDialog = dialogBuilder.create(); scheduleDownloadDialog.setTitle(getText(R.string.schDwnBtn)); scheduleDownloadDialog.setIcon(android.R.drawable.ic_dialog_alert); scheduleDownloadDialog.setCancelable(false); scheduleDownloadDialog.setMessage(getText(R.string.schDown_install)); scheduleDownloadDialog.setButton(Dialog.BUTTON_POSITIVE, getString(android.R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { for (String scheduledDownload : scheduledDownloadsHashMap.keySet()) { ScheduledDownload schDown = scheduledDownloadsHashMap.get(scheduledDownload); ViewApk apk = new ViewApk(); apk.setApkid(schDown.getApkid()); apk.setName(schDown.getName()); apk.setVercode(schDown.getVercode()); apk.setIconPath(schDown.getIconPath()); apk.setVername(schDown.getVername()); apk.setRepoName(schDown.getRepoName()); serviceDownloadManager .startDownloadWithWebservice(serviceDownloadManager.getDownload(apk), apk); Toast toast = Toast.makeText(ScheduledDownloads.this, R.string.starting_download, Toast.LENGTH_SHORT); toast.show(); } finish(); } }); scheduleDownloadDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.no), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { finish(); } }); scheduleDownloadDialog.show(); } }
From source file:com.glm.trainer.NewMainActivity.java
/** * Visualizza una alert per il GPS non abilitato * * @author Gianluca Masci aka (GLM)//from w ww . ja v a 2s. c o m * */ public void ShowAlertNoGPS() { try { AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(this.getString(R.string.titlegps)); alertDialog.setMessage(this.getString(R.string.messagegpsnoenabled)); alertDialog.setButton(this.getString(R.string.yes), new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { Intent myIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(myIntent); } }); alertDialog.setButton2(this.getString(R.string.no), new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); alertDialog.show(); } catch (Exception e) { Toast.makeText(this, "ERROR DIALOG:" + e.getMessage(), Toast.LENGTH_SHORT).show(); Log.e("MEEERR: ", e.getMessage()); } }
From source file:org.loon.framework.android.game.LGameActivity.java
/** * ??Alter//from ww w. ja v a2 s . c o m * * @param message */ public void showAndroidAlert(final String title, final String message) { Runnable showAlert = new Runnable() { public void run() { final AlertDialog alert = new AlertDialog.Builder(LGameActivity.this).create(); alert.setTitle(title); alert.setMessage(message); alert.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { alert.dismiss(); } }); alert.show(); } }; runOnUiThread(showAlert); }