【发布时间】:2016-10-05 04:55:53
【问题描述】:
Android 开发者。我有一个 SQLite 数据库。我的专栏之一叫做 KEY_SWITCH。我想将此列表中的整数转换为 ArrayList,然后将其打印到我的控制台。
这是我的代码:
public ArrayList<Integer> getAllIntegerValues() {
ArrayList<Integer> yourIntegerValues = new ArrayList<Integer>();
Cursor result = db.query(true, DATABASE_TABLE,
new String[] {KEY_SWITCH}, null, null, null, null,
null, null);
if (result.moveToFirst()) {
do {
yourIntegerValues.add(result.getInt(result
.getColumnIndex(KEY_SWITCH)));
} while (result.moveToNext());
} else {
return null;
}
System.out.print(yourIntegerValues);
return yourIntegerValues;
}
我这样运行代码
DBAdapter_Metrics mydbmetric;
private SQLiteDatabase dbmetric;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_metric_list);
openDBMetrics();
populateListViewFromDNewBMetric();
mydbmetric.getAllIntegerValues();
}
当我运行代码时,我收到以下错误:
endAllActiveAnimators on 0x915c1380 (RippleDrawable) with handle 0x8f550150
为什么不打印我的 ArrayList?
我试图搜索这个错误,但我发现错误的变化取决于我在代码中启动getAllIntegerValues() 的位置
例如,当我创建一个带有运行选项的下拉菜单时,我收到此错误
endAllActiveAnimators on 0x8e3b5300 (MenuPopupWindow$MenuDropDownListView) with handle 0x8ef83f50
所以它似乎会根据我运行它的位置而发生变化,我不明白。
【问题讨论】: