java.lang.Object tag = v.getTag();
if (tag instanceof java.lang.String) {
java.lang.String waybillNum = (java.lang.String) tag;
android.support.v7.app.AlertDialog alertDialog = new AlertDialog.Builder(this)
.setMessage("你確定要刪除" + waybillNum + "本地緩存數據嗎?")
.setNegativeButton("取消", null)
.setTitle("溫馨提示")
.setPositiveButton("確定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (dialog instanceof AlertDialog) {
AlertDialog alertDialog = (AlertDialog) dialog;
Button button = alertDialog.<Button>findViewById(android.R.id.button1);
if (button != null) {
Object tag = button.getTag();
if (tag instanceof String) {
String waybillNum = (String) tag;
Log.d("debug", "打印tag->" + waybillNum);
int deleteResultForWaybillDO = deleteWaybillDoByWaybillNum(waybillNum);
int deleteResultForWaybillSubDO = deleteWaybillSubDoByWaybillNum(waybillNum);
if (deleteResultForWaybillDO > 0 && deleteResultForWaybillSubDO > 0) {
Toast.makeText(AccordingToDriverDeliveryScanActivity.this, "刪除成功", Toast.LENGTH_LONG).show();
refreshInterfaceDisplayData(null);
}
}
}
}
}
})
.create();
alertDialog.show();
android.widget.Button button = alertDialog.<android.widget.Button>findViewById(android.R.id.button1);
if (button != null) {
button.setTag(waybillNum);
}
}文章来源地址https://www.toymoban.com/news/detail-470429.html
文章来源:https://www.toymoban.com/news/detail-470429.html
到了这里,关于Android通过AlertDialog传递局部参数的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!