List of usage examples for android.app AlertDialog setMessage
public void setMessage(CharSequence message)
From source file:com.swetha.easypark.DisplayVacantParkingLots.java
@SuppressWarnings("deprecation") public void updatemap(ArrayList<HashMap<String, String>> alofHashmap, int Success) { if (success == 1) { try {//from ww w . j a va2 s . c om googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.parkinglotsmap)) .getMap(); IconGenerator ig = new IconGenerator(this); googleMap.clear(); for (int i = (alofHashmap.size() - 1); i >= 0; i--) { //canvas.drawText(alofHashmap.get(i).get("costForParking"), 0, 40, paint); LatLng latLng = new LatLng(Double.parseDouble(alofHashmap.get(i).get("latitude")), Double.parseDouble(alofHashmap.get(i).get("longitude"))); Bitmap bmp = ig.makeIcon(alofHashmap.get(i).get("costForParking")); googleMap.addMarker(new MarkerOptions().position(latLng) //.title() //.snippet(alofHashmap.get(i).get("lotsInfoTextView")) .icon(BitmapDescriptorFactory.fromBitmap(bmp))).showInfoWindow(); //.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_car))).showInfoWindow(); googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); } googleMap.setOnMarkerClickListener(new OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker arg0) { LatLng markerLatLng = arg0.getPosition(); Log.i("DisplayVacantParkingLots", "Value of the marker that was clicked is" + markerLatLng.toString()); for (int i = (parkingLotsMapList.size() - 1); i >= 0; i--) { Log.i("DisplayVacantParkingLots", "value in the parkinglots map inside for loop" + parkingLotsMapList.get(i).toString()); if (parkingLotsMapList.get(i).containsValue(String.valueOf(markerLatLng.latitude)) && parkingLotsMapList.get(i) .containsValue(String.valueOf(markerLatLng.longitude))) { Intent intent = new Intent(DisplayVacantParkingLots.this, GetIndividualParkingSpotDetails.class); intent.putExtra("individualParkingLotId", parkingLotsMapList.get(i).get("vacantParkingLotId")); Log.i("DisplayVacantParkingLots", "The value of the parkinglot of the marker clicked is" + parkingLotsMapList.get(i).get("vacantParkingLotId")); intent.putExtra(GetParkingLots.FROMTIME, DisplayVacantParkingLots.fromTime); intent.putExtra(GetParkingLots.TOTIME, DisplayVacantParkingLots.toTime); startActivity(intent); } } return true; } }); } catch (Exception e) { } finally { } } else { AlertDialog alertDialog = new AlertDialog.Builder(DisplayVacantParkingLots.this).create(); alertDialog.setTitle("Sorry!"); alertDialog.setMessage("No parking lots found"); 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(DisplayVacantParkingLots.this, GetParkingLots.class); startActivity(intent); } }); alertDialog.show(); } }
From source file:net.networksaremadeofstring.cyllell.ViewEnvironments_Fragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { list = (ListView) this.getActivity().findViewById(R.id.environmentsListView); settings = this.getActivity().getSharedPreferences("Cyllell", 0); try {//from w ww .ja va2s . co m Cut = new Cuts(getActivity()); } catch (Exception e) { e.printStackTrace(); } dialog = new ProgressDialog(getActivity()); dialog.setTitle("Contacting Chef"); dialog.setMessage("Please wait: Prepping Authentication protocols"); dialog.setIndeterminate(true); if (listOfEnvironments.size() < 1) { dialog.show(); } updateListNotify = new Handler() { public void handleMessage(Message msg) { int tag = msg.getData().getInt("tag", 999999); if (msg.what == 0) { if (tag != 999999) { listOfEnvironments.get(tag).SetSpinnerVisible(); } } else if (msg.what == 1) { //Get rid of the lock CutInProgress = false; //the notifyDataSetChanged() will handle the rest } else if (msg.what == 99) { if (tag != 999999) { Toast.makeText(ViewEnvironments_Fragment.this.getActivity(), "An error occured during that operation.", Toast.LENGTH_LONG).show(); listOfEnvironments.get(tag).SetErrorState(); } } EnvironmentAdapter.notifyDataSetChanged(); } }; final Handler handler = new Handler() { public void handleMessage(Message msg) { //Once we've checked the data is good to use start processing it if (msg.what == 0) { OnClickListener listener = new OnClickListener() { public void onClick(View v) { //Log.i("OnClick","Clicked"); GetMoreDetails((Integer) v.getTag()); } }; OnLongClickListener listenerLong = new OnLongClickListener() { public boolean onLongClick(View v) { selectForCAB((Integer) v.getTag()); return true; } }; EnvironmentAdapter = new EnvironmentListAdaptor(getActivity().getBaseContext(), listOfEnvironments, listener, listenerLong); list = (ListView) getView().findViewById(R.id.environmentsListView); if (list != null) { if (EnvironmentAdapter != null) { list.setAdapter(EnvironmentAdapter); } else { //Log.e("EnvironmentAdapter","EnvironmentAdapter is null"); } } else { //Log.e("List","List is null"); } dialog.dismiss(); } else if (msg.what == 200) { dialog.setMessage("Sending request to Chef..."); } else if (msg.what == 201) { dialog.setMessage("Parsing JSON....."); } else if (msg.what == 202) { dialog.setMessage("Populating UI!"); } else { //Close the Progress dialog dialog.dismiss(); //Alert the user that something went terribly wrong AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setTitle("API Error"); alertDialog.setMessage("There was an error communicating with the API:\n" + msg.getData().getString("exception")); alertDialog.setButton2("Back", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { getActivity().finish(); } }); alertDialog.setIcon(R.drawable.icon); alertDialog.show(); } } }; Thread dataPreload = new Thread() { public void run() { if (listOfEnvironments.size() > 0) { handler.sendEmptyMessage(0); } else { try { handler.sendEmptyMessage(200); Environments = Cut.GetEnvironments(); handler.sendEmptyMessage(201); JSONArray Keys = Environments.names(); for (int i = 0; i < Keys.length(); i++) { listOfEnvironments.add( new Environment(Keys.getString(i), Environments.getString(Keys.getString(i)) .replaceFirst("^(https://|http://).*/environments/", ""))); } handler.sendEmptyMessage(202); handler.sendEmptyMessage(0); } catch (Exception e) { Message msg = new Message(); Bundle data = new Bundle(); data.putString("exception", e.getMessage()); msg.setData(data); msg.what = 1; handler.sendMessage(msg); } } return; } }; dataPreload.start(); return inflater.inflate(R.layout.environments_landing, container, false); }
From source file:com.tweetlanes.android.view.ComposeBaseFragment.java
void showSimpleAlert(int stringID) { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setMessage(getString(stringID)); alertDialog.setButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; }//from w w w.j a va 2 s.c o m }); alertDialog.show(); }
From source file:com.csipsimple.ui.calllog.CallLogListFragment.java
private void deleteAllCalls() { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setTitle(R.string.callLog_delDialog_title); alertDialog.setMessage(getString(R.string.callLog_delDialog_message)); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.callLog_delDialog_yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { getActivity().getContentResolver().delete(SipManager.CALLLOG_URI, null, null); }// ww w . j av a 2s . c om }); alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.callLog_delDialog_no), (DialogInterface.OnClickListener) null); try { alertDialog.show(); } catch (Exception e) { Log.e(THIS_FILE, "error while trying to show deletion yes/no dialog"); } }
From source file:com.shafiq.mytwittle.view.ComposeBaseFragment.java
void showSimpleAlert(int stringID) { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setMessage(getString(stringID)); alertDialog.setButton(getString(R.string.ok), new DialogInterface.OnClickListener() { @Override//from w w w .j a v a 2 s .com public void onClick(DialogInterface dialog, int which) { return; } }); alertDialog.show(); }
From source file:com.acrylicgoat.devchat.MainActivity.java
private void displayPopup() { //retrieve yesterday's data String yData = getYesterday(currentOwner); if (yData.equals("")) { yData = getString(R.string.no_yesterday); }// w w w. ja v a 2s . c o m //display in popup AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Last Chat"); alertDialog.setMessage(yData); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "Done", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //do nothing } }); alertDialog.show(); }
From source file:com.acrylicgoat.scrumnotes.MainActivity.java
private void displayPopup() { //retrieve yesterday's data String yData = getYesterday(currentOwner); if (yData.equals("")) { yData = getString(R.string.no_yesterday); }/* w ww . ja v a 2 s . co m*/ //display in popup AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Yesterday"); alertDialog.setMessage(yData); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "Done", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //do nothing } }); alertDialog.show(); }
From source file:com.workingagenda.democracydroid.Adapters.ViewHolders.EpisodeViewHolder.java
@RequiresApi(api = Build.VERSION_CODES.M) @Override//from w w w. j a v a2 s. c o m public boolean onMenuItemClick(MenuItem menuItem) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(itemView.getContext()); int DEFAULT_STREAM = Integer.parseInt(preferences.getString("stream_preference", "0")); // 0=video int DEFAULT_OPEN = Integer.parseInt(preferences.getString("open_preference", "0")); // 0 = within this ap String actionTitle = "Democracy Now!"; if (mEpisode.getTitle().length() > 16) { if ("Today's Broadcast".equals(mEpisode.getTitle())) { actionTitle = mEpisode.getTitle(); } else if (mEpisode.getTitle().startsWith("Democracy Now!")) { actionTitle = mEpisode.getTitle().substring(14); } else { actionTitle = mEpisode.getTitle(); } } switch (menuItem.getItemId()) { case R.id.action_share: Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_SUBJECT, mEpisode.getTitle()); sendIntent.putExtra(Intent.EXTRA_TEXT, mEpisode.getUrl()); sendIntent.setType("text/plain"); itemView.getContext().startActivity(sendIntent); return true; case R.id.reverse_default_media: if (mEpisode.getVideoUrl().contains("m3u8")) startMediaIntent(mEpisode.getAudioUrl(), 1, mEpisode.getTitle()); else if (DEFAULT_STREAM == 0) startMediaIntent(mEpisode.getAudioUrl(), DEFAULT_OPEN, actionTitle); else startMediaIntent(mEpisode.getVideoUrl(), DEFAULT_OPEN, actionTitle); return true; case R.id.reverse_default_open: int reverseOpen = 0; if (reverseOpen == DEFAULT_OPEN) reverseOpen = 1; if (DEFAULT_STREAM == 0) startMediaIntent(mEpisode.getVideoUrl(), reverseOpen, actionTitle); else startMediaIntent(mEpisode.getAudioUrl(), reverseOpen, actionTitle); return true; case R.id.action_description: AlertDialog description = new AlertDialog.Builder(itemView.getContext()).create(); // Get Description and Title description.setTitle("The War and Peace Report"); description.setMessage(mEpisode.getDescription() + "\n\n" + mEpisode.getTitle()); description.setButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }); description.show(); return true; case R.id.video_download: if (mEpisode.getTitle().equals("Stream Live")) return true; Download(mEpisode.getVideoUrl(), mEpisode.getTitle(), mEpisode.getDescription()); return true; case R.id.audio_download: if (mEpisode.getTitle().equals("Stream Live")) return true; Download(mEpisode.getAudioUrl(), mEpisode.getTitle(), mEpisode.getDescription()); return true; case R.id.open_browser: Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(mEpisode.getUrl()), "*/*"); itemView.getContext().startActivity(intent); return true; } return false; }
From source file:sssemil.com.hostsaway.ui.BlacklistFragment.java
/** * Add new entry based on input/*from w ww . j av a 2s . c om*/ * * @param input */ private void addEntry(String input) { if (input != null) { if (RegexUtils.isValidHostname(input)) { ProviderHelper.insertBlacklistItem(mActivity, input); } 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(sssemil.com.hostsaway.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:sssemil.com.hostsaway.ui.WhitelistFragment.java
/** * Add new entry based on input/* w w w .j av a 2 s. c om*/ * * @param input */ private void addEntry(String input) { if (input != null) { if (RegexUtils.isValidWhitelistHostname(input)) { ProviderHelper.insertWhitelistItem(mActivity, input); } 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(sssemil.com.hostsaway.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(); } } }