我使用以下代码从db表中检索值。
public List<String> getProcedure() {
List<String> labels = new ArrayList<String>();
String selectQuery = "SELECT * FROM " + TABLENAME;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
Log.d("before", "if");
if (cursor.moveToFirst()) {
Log.d("inside", "if");
while (cursor.moveToNext()) {
Log.d("inside", "while");
labels.add(cursor.getString(1));
}
}
cursor.close();
db.close();
return labels;
}
我从来没有在logcat中获取“if if”中的日志消息。 这是什么意思?
我在表格中有数据,因此无法检索它!我该如何纠正?请帮忙!!
我的堆栈跟踪:
E/SensorManager(6951): thread start
D/SensorManager(6951): registerListener :: handle = 4 name= MPL accel delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@4207eb60
D/before(6951): if
D/SensorManager(6951): unregisterListener:: Listener= android.view.OrientationEventListener$SensorEventListenerImpl@4207eb60
D/Sensors(6951): Remain listener = Sending .. normal delay 200ms
I/Sensors(6951): sendDelay --- 200000000
D/SensorManager(6951): JNI - sendDelay
I/SensorManager(6951): Set normal delay = true
D/SensorManager(6951): registerListener :: handle = 4 name= MPL accel delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@4207eb60
I/Adreno200-EGLSUB(6951): <ConfigWindowMatch:2087>: Format RGBA_8888.
E/SpannableStringBuilder(6951): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
E/SpannableStringBuilder(6951): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length