我正在尝试使用我的数据库中的一些数据,但函数只使用第一个条目中的数据。我应该添加什么来浏览数据库中的所有条目?
public void drawdayplan(){
DatabaseConnector dbConnector = new DatabaseConnector(Clock.this);
Intent a = getIntent();
String d_m_y = a.getStringExtra("d_m_y");
dbConnector.open();
Cursor result = dbConnector.gethour(d_m_y);
if(result.moveToFirst()){
int hourfromIndex = result.getColumnIndex("inthourfrom");
int hourtoIndex = result.getColumnIndex("inthourto");
int colourIndex = result.getColumnIndex("colour");
hourfrom = result.getInt(hourfromIndex);
hourto = result.getInt(hourtoIndex);
colour = result.getString(colourIndex);
// here are some steps with painting which are using this variables
}
}
result.close();
dbConnector.close();
}