我要实现的功能是首先把list中的数据挨个拿出来和数据库中的对比,如果数据库中没有直接插入,如果有就显示对话框是否需要插入,在遍历完后要求跳转到结果类中,求个高手指点下怎么写,自己写的flage不顶用loop:for (int i = 0; i < arrayList.size(); i++) {
if (cursor.getCount()>0) {
cursor.moveToFirst();
do {
AlertDialog dialog = new AlertDialog.Builder(AreaCleanActivity.this).setMessage("数据库中以及查到有对应编号的记录,是否覆盖")
.setPositiveButton("确定 ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
flage = true;
} catch (Exception e) {
e.printStackTrace();
}
}
}).setNegativeButton("取消 ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
break loop;
return;
}
}).create();
dialog.show();
} while (cursor.moveToNext()); }else {
... }
}
for循环里面的cursor查询,对话框中如何跳出for循环
if (cursor.getCount()>0) {
cursor.moveToFirst();
do {
AlertDialog dialog = new AlertDialog.Builder(AreaCleanActivity.this).setMessage("数据库中以及查到有对应编号的记录,是否覆盖")
.setPositiveButton("确定 ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
flage = true;
} catch (Exception e) {
e.printStackTrace();
}
}
}).setNegativeButton("取消 ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
break loop;
return;
}
}).create();
dialog.show();
} while (cursor.moveToNext()); }else {
... }
}
for循环里面的cursor查询,对话框中如何跳出for循环
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货