0
いくつかのレコードを含むデータベースがありますが、各行で実行したいコードがありますが、適切なループを作成するのに問題がありますが、(movetonext)ワーキング。私は必要があるだろう何データベースレコードを使用したコードのループ
cursor = getAppts();
cursor.moveToNext();
String titlefromdb = cursor.getString(3);
if (strTitle.equals(titlefromdb) && cursor.getString(1).equals(dateselforap))
{
// matching code update box
final Dialog matchdiag = new Dialog(CW2Organisor.this);
matchdiag.setContentView(R.layout.apptmatch);
matchdiag.setTitle("View/Edit Appointment");
matchdiag.setCancelable(true);
TextView matchtxt = (TextView) matchdiag.findViewById(R.id.matchtxt);
matchtxt.setText("Appointment \"" + titlefromdb + "\" already exists, please choose a different event title");
Button btnmatchok = (Button) matchdiag.findViewById(R.id.btnmatch);
btnmatchok.setOnClickListener(new OnClickListener() {
// on click for cancel button
@Override
public void onClick(View v) {
matchdiag.dismiss();
}
});
matchdiag.show();
}
else
{
addAppt(strTime, strTitle, strDet);
dialog.dismiss();
}
は、私は現在の行のタイトルフィールドを保持し、if文を実行し、次の行に移動するためtitlefromdbを必要とする私のデータベースの行ごとにあります。
コードをフォーマットしてください。 –