List of usage examples for android.app AlertDialog.Builder setTitle
@Override public void setTitle(CharSequence title)
From source file:com.adarshahd.indianrailinfo.donate.PNRStat.java
private void combineTrainAndPsnDetails() { if (mPageResult.contains("FLUSHED PNR / ") || mPageResult.contains("Invalid PNR")) { mTextViewPNRSts.setText("The PNR entered is either invalid or expired! Please check."); mFrameLayout.removeAllViews();/*from w ww. j a va 2s . c o m*/ mFrameLayout.addView(mTextViewPNRSts); return; } if (mPageResult.contains("Connectivity Failure") || mPageResult.contains("try again")) { mTextViewPNRSts.setText("Looks like server is busy or currently unavailable. Please try again later!"); mFrameLayout.removeAllViews(); mFrameLayout.addView(mTextViewPNRSts); return; } //Combine both Train & Passenger details table into a single LinearLayout and add it to FrameLayout LinearLayout ll = new LinearLayout(mActivity); TextView textViewTrnDtls = new TextView(mActivity); TextView textViewPsnDtls = new TextView(mActivity); textViewTrnDtls.setText("Train Details: " + mPNRNumber); textViewTrnDtls.setFocusable(true); textViewPsnDtls.setText("Passenger Details"); textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewPsnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewTrnDtls.setPadding(10, 10, 10, 10); textViewPsnDtls.setPadding(10, 10, 10, 10); textViewTrnDtls.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); textViewPsnDtls.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); ll.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ll.setOrientation(LinearLayout.VERTICAL); ll.addView(textViewTrnDtls); ll.addView(mTableLayoutTrn); ll.addView(textViewPsnDtls); ll.addView(mTableLayoutPsn); mFrameLayout.removeAllViews(); mFrameLayout.addView(ll); if (isWaitingList && !mPNRList.contains(mPNRNumber)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Track this PNR?"); builder.setMessage("Would you like this PNR to be tracked for status change?"); builder.setPositiveButton("Track", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //save the pnr pnrDB.addPNRToTrack(mPNRNumber); dialog.dismiss(); } }); builder.setNegativeButton("No thanks", null); builder.create().show(); } }
From source file:com.andybotting.tubechaser.activity.StationDetail.java
/** * Show line select dialog/* w w w .j a v a2 s . c o m*/ */ private void showLineSelect(final List<Line> lines) { ListAdapter adapter = new LinesListAdapter(mContext, -1, lines); final AlertDialog.Builder ad = new AlertDialog.Builder(this); ad.setTitle("Select Line"); ad.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mLine = lines.get(which); dialog.dismiss(); displayStation(); } }); ad.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { // Just end our activity if no line is selected StationDetail.this.finish(); } }); ad.create(); ad.show(); }
From source file:com.rei.lolchat.ui.Login.java
/** * Create an about "BEEM" dialog.// ww w. j a v a 2 s .co m */ private void createAboutDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); String versionname; try { PackageManager pm = getPackageManager(); PackageInfo pi = pm.getPackageInfo("com.rei.lolchat", 0); versionname = pi.versionName; } catch (PackageManager.NameNotFoundException e) { versionname = ""; } String title = getString(R.string.login_about_title, versionname); builder.setTitle(title).setMessage(R.string.login_about_msg).setCancelable(false); builder.setNeutralButton(R.string.login_about_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); AlertDialog aboutDialog = builder.create(); aboutDialog.show(); }
From source file:edu.missouri.niaaa.pain.activity.AdminManageActivity.java
private Dialog removeDialog(Context context) { LayoutInflater inflater = LayoutInflater.from(context); final View textEntryView = inflater.inflate(R.layout.remove_id, null); final CheckBox rm_check = (CheckBox) textEntryView.findViewById(R.id.rm_local); rm_check.setText(R.string.remove_local); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setView(textEntryView);/* w w w . j av a 2 s. co m*/ builder.setCancelable(false); builder.setTitle(R.string.assign_remove_title); builder.setMessage(R.string.remove_msg); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub cleanUp(ctx); cancelAlarms(ctx); // remove local file, if checked Log.d(TAG, "is checked " + rm_check.isChecked()); if (rm_check.isChecked()) { deleteDirectory(Util.PHONE_BASE_PATH); } setHints(); finish(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); return builder.create(); }
From source file:com.example.devesh.Coride.DriverRegistration.java
public void showSettingsAlert(String provider) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(DriverRegistration.this); alertDialog.setTitle(provider + " SETTINGS"); alertDialog.setMessage(provider + " is not enabled! Want to go to settings menu?"); alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); DriverRegistration.this.startActivity(intent); dialog.cancel();/*w ww .j a v a 2 s .co m*/ } }); alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Toast.makeText(getApplicationContext(), "Enable location to use APP", Toast.LENGTH_SHORT).show(); dialog.cancel(); } }); alertDialog.show(); }
From source file:com.t2.compassionMeditation.DeviceManagerActivity.java
/** * Handles UI button clicks/*from ww w.j a v a 2 s . c o m*/ * @param v */ public void onButtonClick(final View v) { final int id = v.getId(); switch (id) { // Present a list of all parameter types to allow the user // to associate a specific device (address) to a specific parameter // This association will be used in the main activities so that they // know the BT address of particular sensors to tell them to start/stop // The associations are stored in Shared pref // key = param name (See R.array.parameter_names) // value = BT address case R.id.parameter: final String address = (String) v.getTag(); AlertDialog.Builder alertParamChooser = new AlertDialog.Builder(mInstance); alertParamChooser.setTitle("Select parameter for this device"); // mParamChooserAlert = alertParamChooser.create(); alertParamChooser.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); alertParamChooser.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); alertParamChooser.setSingleChoiceItems(R.array.parameter_names, -1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, final int which) { String[] paramNamesStringArray = getResources().getStringArray(R.array.parameter_names); final String name = paramNamesStringArray[which]; // See which pamrameter is associated with this name String device = SharedPref.getDeviceForParam(mInstance, name); if (device != null && which != 0) { AlertDialog.Builder alertWarning = new AlertDialog.Builder(mInstance); String message = String.format( "Another sensor (%s) currently feeds this parameter. Please change this previous mapping before trying again", device); alertWarning.setMessage(message); alertWarning.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mParamChooserAlert.dismiss(); } }); alertWarning.setNegativeButton("Select Anyway", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Log.d(TAG, "param name = " + name + ", address = " + address); if (which != 0) { SharedPref.setParamForDevice(mInstance, name, address); v.getBackground().setColorFilter(Color.GREEN, PorterDuff.Mode.MULTIPLY); ((Button) v.findViewById(R.id.parameter)).setText(name); } else { SharedPref.setParamForDevice(mInstance, name, address); v.getBackground().setColorFilter(Color.LTGRAY, PorterDuff.Mode.MULTIPLY); ((Button) v.findViewById(R.id.parameter)).setText("Parameter"); } } }); alertWarning.show(); } else { // The parameter is currently not mapped to a sensor, so we can go ahead and map it Log.d(TAG, "param name = " + name + ", address = " + address); if (which != 0) { SharedPref.setParamForDevice(mInstance, name, address); v.getBackground().setColorFilter(Color.GREEN, PorterDuff.Mode.MULTIPLY); ((Button) v.findViewById(R.id.parameter)).setText(name); } else { SharedPref.setParamForDevice(mInstance, name, address); v.getBackground().setColorFilter(Color.LTGRAY, PorterDuff.Mode.MULTIPLY); ((Button) v.findViewById(R.id.parameter)).setText("Parameter"); } } } }); // alert.show(); mParamChooserAlert = alertParamChooser.create(); mParamChooserAlert.show(); break; } }
From source file:com.andybotting.tubechaser.activity.Home.java
/** * Show about dialog window//from w w w.jav a 2 s. c o m */ public void showAbout() { // Get the package name String heading = getResources().getText(R.string.app_name) + "\n"; try { PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0); heading += "v" + pi.versionName + "\n\n"; } catch (NameNotFoundException e) { e.printStackTrace(); } // Build alert dialog AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle(heading); View aboutView = getLayoutInflater().inflate(R.layout.dialog_about, null); dialogBuilder.setView(aboutView); dialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Set first launch flag in DB mPreferenceHelper.setFirstLaunchThisVersion(); } }); dialogBuilder.setCancelable(false); dialogBuilder.setIcon(R.drawable.appicon); dialogBuilder.show(); }
From source file:org.ohthehumanity.carrie.CarrieActivity.java
/** Called when the activity is first created. */ @Override//from w w w . ja va 2s.c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mServerName = ""; setContentView(R.layout.main); // instantiate our preferences backend mPreferences = PreferenceManager.getDefaultSharedPreferences(this); // set callback function when settings change mPreferences.registerOnSharedPreferenceChangeListener(this); if (mPreferences.getString("server", null) == null) { setStatus("Server not set"); } else if (mPreferences.getString("port", null) == null) { setStatus("Port not configured"); } ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (cm.getActiveNetworkInfo().getType() != ConnectivityManager.TYPE_WIFI) { AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this); dlgAlert.setTitle("WiFi not active"); dlgAlert.setMessage( "This application is usually used on a local network over a WiFi. Open WiFi settings?"); dlgAlert.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: //Yes button clicked final Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_LAUNCHER); final ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.wifi.WifiSettings"); intent.setComponent(cn); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); break; case DialogInterface.BUTTON_NEGATIVE: //Log.i(TAG, "Not opening wifi"); //No button clicked break; } } }); dlgAlert.setNegativeButton("No", null); dlgAlert.setCancelable(true); dlgAlert.create().show(); } updateTitle(); updateSkipLabels(); updateServerName(); }
From source file:br.liveo.ndrawer.ui.fragment.MainFragment31.java
private void stopUseBeacon(int position) { final String beaconmac = mMyDeviceAdapter.getDeviceList().get(position).getBdAddr(); AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setTitle(" ?"); alertDialog.setMessage("? ? ?"); alertDialog.setIcon(R.drawable.alert); alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { updateEvent("BEACON_STOP"); StopUseBeacon stopUseBeacon = new StopUseBeacon(); stopUseBeacon.execute("http://125.131.73.198:3000/beaconStop", beaconmac); }/* www .j a v a 2 s . co m*/ }); alertDialog.setNegativeButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alertDialog.show(); }
From source file:br.liveo.ndrawer.ui.fragment.MainFragment31.java
public void deleteBeacon(int position) { final String beaconmac = mMyDeviceAdapter.getDeviceList().get(position).getBdAddr(); AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setTitle(" ?"); alertDialog.setMessage("? ? ?"); alertDialog.setIcon(R.drawable.alert); alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { updateEvent("BEACON_DELETE"); DeleteBeacon deleteBeacon = new DeleteBeacon(); deleteBeacon.execute("http://125.131.73.198:3000/beconDelete", beaconmac); }// ww w.j a va 2 s .com }); alertDialog.setNegativeButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alertDialog.show(); }