She*_*tib 11
这不是一个Toast信息; 它是一个AlertDialog
public class yourActivity extends Activity {
public final static int DIALOG_ERROR = 1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
showDialog(DIALOG_ERROR); //this will call: onCreateDialog()
}
protected Dialog onCreateDialog(int id) {
Dialog dialog;
switch(id) {
case DIALOG_ERROR:
//create dialog
dialog = new AlertDialog.Builder(this).setMessage("Messaging").create();
break;
default:
//create a default dialog
dialog = null;
}
return dialog;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
207 次 |
| 最近记录: |