写在这里便于以后查看。
Android中弹出对话框的关键代码:
1 btn01.setOnClickListener(new OnClickListener() { 2 3 @Override 4 public void onClick(View v) { 5 Toast.makeText(musicActivity.this, "tanchu", 100).show(); 6 // 以下是弹出对话框的关键代码, 7 AlertDialog.Builder b = new AlertDialog.Builder( 8 musicActivity.this); 9 b.setTitle("wyl"); 10 b.setIcon(R.drawable.icon); 11 b.setCancelable(true); 12 b.setMessage("这是.setMessage(String str)方法"); 13 b.setPositiveButton("positivieButton..", 14 new DialogInterface.OnClickListener() { 15 16 @Override 17 public void onClick(DialogInterface dialog, 18 int which) { 19 20 Toast.makeText(musicActivity.this, 21 "xxxxxxxxxx", 100).show(); 22 23 } 24 }); 25 b.setNegativeButton("否", new DialogInterface.OnClickListener() { 26 27 @Override 28 public void onClick(DialogInterface dialog, int which) { 29 // TODO Auto-generated method stub 30 Toast.makeText(musicActivity.this, "否...", 100).show(); 31 } 32 }); 33 b.create().show(); 34 } 35 });