整理一些android的代码,看有谁需要了,备用。
一个最简单的对话框,比如确认要删除文件之类的:
带取消的提示框:
原创内容如转载请注明:来自 阿权的书房
一个最简单的对话框,比如确认要删除文件之类的:
//code from http://aslibra.com/
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("确定要删除此篇文章?")
.setCancelable(false)
.setPositiveButton("删除", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
//do sth
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
builder.create().show();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("确定要删除此篇文章?")
.setCancelable(false)
.setPositiveButton("删除", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
//do sth
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
builder.create().show();
带取消的提示框:
//code from http://aslibra.com/
myDialog = ProgressDialog.show(Article.this, "请稍候", tips, true);
myDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
dialog.dismiss();
//TODO sth
}
});
myDialog = ProgressDialog.show(Article.this, "请稍候", tips, true);
myDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
dialog.dismiss();
//TODO sth
}
});
原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
梁文道的读者交流会
建立linux网关和端口转发
