写在这里便于以后查看。
Android中弹出对话框的关键代码:
btn01.setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
Toast.makeText(musicActivity.this, "tanchu", 100).show();
// 以下是弹出对话框的关键代码,
AlertDialog.Builder b = new AlertDialog.Builder(
musicActivity.this);
b.setTitle("wyl");
b.setIcon(R.drawable.icon);
b.setCancelable(true);
b.setMessage("这是.setMessage(String str)方法");
b.setPositiveButton("positivieButton..",
new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog,
int which) { Toast.makeText(musicActivity.this,
"xxxxxxxxxx", 100).show(); }
});
b.setNegativeButton("否", new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Toast.makeText(musicActivity.this, "否...", 100).show();
}
});
b.create().show();
}
});