AlertDialog setMessage - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AlertDialog setMessage method.

This code example shows how to use the following methods:setButton, setMessage, setTitle, dismiss, isShowing
            dialog = new AlertDialog.Builder(context)
                    .setPositiveButton(android.R.string.ok, disconnectListener)
                    .setNegativeButton(android.R.string.cancel, null)
                    .create();
        } else { 
            if (dialog.isShowing()) {
                dialog.dismiss();
            } 
            // use disconnectListener for the correct profile(s) 
            CharSequence okText = context.getText(android.R.string.ok);
            dialog.setButton(DialogInterface.BUTTON_POSITIVE,
                    okText, disconnectListener);
        } 
        dialog.setTitle(title);
        dialog.setMessage(message);
        dialog.show();
        return dialog;
    } 
 
    // TODO: wire this up to show connection errors... 
    static void showConnectingError(Context context, String name) {
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setIcon, setMessage, setTitle, setCancelable, show
			tvResult.setText(""); 
 
			Calendar now = Calendar.getInstance(); 
 
			DatePickerDialog datePicDlg =  
					new DatePickerDialog(Ch09DateTimeDialog.this, 
					dsListener,	now.get(Calendar.YEAR), 
					now.get(Calendar.MONTH),  
					now.get(Calendar.DAY_OF_MONTH)); 
			datePicDlg.setTitle("輸入日期"); 
			datePicDlg.setMessage("請輸入日期"); 
			datePicDlg.setIcon(android.R.drawable.ic_dialog_info); 
			datePicDlg.setCancelable(false); 
			datePicDlg.show(); 
		} 
	}; 
	 
    private OnDateSetListener dsListener = new OnDateSetListener() {    
		public void onDateSet (DatePicker view, int year,  
				               int monthOfYear, int dayOfMonth) { 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMessage, setTitle, show
        mNdefPushMessage = new NdefMessage(new NdefRecord[] { newTextRecord(
                "Message from NFC Reader :-)", Locale.ENGLISH, true) });
    } 
 
    private void showMessage(int title, int message) {
        mDialog.setTitle(title);
        mDialog.setMessage(getText(message));
        mDialog.show();
    } 
 
    private NdefRecord newTextRecord(String text, Locale locale, boolean encodeInUtf8) {
        byte[] langBytes = locale.getLanguage().getBytes(Charset.forName("US-ASCII"));
 
        Charset utfEncoding = encodeInUtf8 ? Charset.forName("UTF-8") : Charset.forName("UTF-16");
        byte[] textBytes = text.getBytes(utfEncoding);
 
        int utfBit = encodeInUtf8 ? 0 : (1 << 7);
        char status = (char) (utfBit + langBytes.length);
 
        byte[] data = new byte[1 + langBytes.length + textBytes.length];
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setButton, setMessage, setTitle, show
			 
			*/ 
			 
		} 
		 
		msgDialog.show();
	} 
	 
	private AlertDialog createAlertDialog(String title, String msg, String buttonText){
		AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
		AlertDialog msgDialog = dialogBuilder.create();
		msgDialog.setTitle(title);
		msgDialog.setMessage(msg);
		msgDialog.setButton(buttonText, new DialogInterface.OnClickListener(){
			@Override 
			public void onClick(DialogInterface dialog, int idx){
				return; // Nothing to see here... 
			} 
		}); 
		 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMessage, show
    { 
        // TODO: Look through cheat options to see if any have really long strings. 
        // If not, then long-pressing on cheat options for full text isn't needed. 
        if( item != 0 )
        { 
            mOptionNoteDialog.setMessage( mOptions[item] );
            mOptionNoteDialog.show();
        } 
    } 
     
    private void refreshWidgets() 
    { 
        setSummary( getSummary() );
        if( mCheckbox != null )
        { 
            mCheckbox.setChecked( isCheatEnabled() );
        } 
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMessage, setTitle, show
            final Calendar c = Calendar.getInstance();        
            int y = c.get(Calendar.YEAR);        
            int m = c.get(Calendar.MONTH);        
            int d = c.get(Calendar.DAY_OF_MONTH);
             
            DatePickerDialog dp = new DatePickerDialog(CartaoActivity.this,new DatePickerDialog.OnDateSetListener() {
              @Override 
              public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                   String erg = "";
                   erg = String.valueOf(dayOfMonth);                      
                   erg += "/" + String.valueOf(monthOfYear+1);                    
                   erg += "/" + year;  
                   ETdata.setText(erg);
                   data = new Date(year-1900, monthOfYear, dayOfMonth);
              } 
 
            }, y, m, d);
            dp.setMessage("Escolha uma Data:");
            dp.setTitle("Escolha uma Data:");
            dp.show();

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setButton, setMessage
	static AlertDialog alert;
	 
	public static AlertDialog createDialog(Context context, String message){
		 
		alert = new AlertDialog.Builder(context).create();
		alert.setButton("OK", new DialogInterface.OnClickListener() {
			 
			public void onClick(DialogInterface dialog, int which) {
				// TODO Auto-generated method stub 
				alert.cancel();
			} 
		}); 
		alert.setMessage(message);
		return alert;
	} 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMessage, show
				} 
			} 
		}; 
 
		// 時刻設定ダイアログの作成 
		timePickerDialog = new TimePickerDialog(this, TimeSetListener,
				hourOfDay, minute, is24HourView);
		// timePickerDialog.setTitle("時間設定"); 
		timePickerDialog.setMessage(settitle);
		timePickerDialog.show();
	}; 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMessage, setTitle
		switch (dialogId) {
			case DIALOG_MANAGE_PATCH:
			case DIALOG_MANAGE_PATCH_CURRENTLY_ENABLED:
			case DIALOG_MANAGE_PATCH_CURRENTLY_DISABLED:
				AlertDialog aDialog = (AlertDialog) dialog;
				aDialog.setTitle(selectedPatchItem.toString());
				break; 
			case DIALOG_PATCH_INFO:
				preparePatchInfo((AlertDialog) dialog, selectedPatchItem);
				break; 
			default: 
				super.onPrepareDialog(dialogId, dialog);
		} 
	} 
 
	public void togglePatch(PatchListItem patch) {
		int maxPatchCount = getMaxPatchCount();
		if (!patch.enabled && maxPatchCount >= 0 && getEnabledCount() >= maxPatchCount) {
			Toast.makeText(this, R.string.manage_patches_too_many, Toast.LENGTH_SHORT).show();
			return; 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMessage
 
	// Code extracted from 
	// http://mobile.tutsplus.com/tutorials/android/android-sdk_datepickerdialog/ 
	@Override 
	protected Dialog onCreateDialog(int id) {
		DatePickerDialog dateDlg = new DatePickerDialog(this,
				new DatePickerDialog.OnDateSetListener() {
					public void onDateSet(DatePicker view, int year,
							int monthOfYear, int dayOfMonth) {
						Time chosenDate = new Time();
						chosenDate.set(dayOfMonth, monthOfYear, year);
						long dtDob = chosenDate.toMillis(true);
						CharSequence strDate = DateFormat.format(
								"MMMM dd, yyyy", dtDob);
						Toast.makeText(HostActivity.this,
								"Date picked: " + strDate, Toast.LENGTH_SHORT)
								.show();
					} 
				}, 2011, 0, 1); 
		dateDlg.setMessage("Transaction date");

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related AlertDialog setMessage Questions & Answers:

Other AlertDialog setMessage Examples

69:	
70:			// Setting Dialog Message
71:			alertDialog.setMessage(message);
72:			
73:			// Setting alert dialog icon

Read More

23:	
24:			// Setting Dialog Message
25:			alertDialog.setMessage(message);
26:	
27:			if(status != null)

Read More

21:	
22:			// Setting Dialog Message
23:			alertDialog.setMessage(message);
24:	
25:			if(status != null)

Read More

setMessage Method Overview
See Code Examples for other Android AlertDialog Methods: