Я пробовал много вещей, чтобы этот код работал, он состоит из показа AlertDialog / описания при прикосновении к элементу / маркеру с карты.Проблема в том, что 3 из 4 маркеров работают (но не показывают правильное описание. Похоже на предыдущее), и последняя сила закрывает приложение с ошибкой logcat:
CursorIndexOutOfBoundsException: Index 4 requested, with a size of 4
Код:
@Override
protected boolean onTap(int index) {
db = openHelper.getWritableDatabase();
String[] columns_descri = new String[] {COL_DESCRI};
Cursor cur = db.query(true, TABLE_COORD, columns_descri,null, null, null, null, null, null);
cur.moveToPosition(index);
String description = cur.getString(cur.getColumnIndexOrThrow(COL_DESCRI));
AlertDialog.Builder dialog = new AlertDialog.Builder(Geo.this);
dialog.setTitle("Infos.");
dialog.setMessage(description);
dialog.setPositiveButton("OK", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
dialog.show();
cur.close();
db.close();
return true;
}