当前位置:   article > 正文

android studio 运行闪退,有没有同学用Android Studio 3.0 做的?运行之后老是闪退,怎么解决?...

symbol factory 3.0闪退

解决了。

有两个地方需要改。public Cursor getAllCostData() {

SQLiteDatabase database = getWritableDatabase();

return database.query("imooc_daily", null, null, null, null, null, "cost_date" +"ASC");

}最后面的排序需要改成 "cost_date ASC"

if (cursor != null) {

while (cursor.moveToNext()) {

CostBean costBean = new CostBean();

costBean.costTitle = cursor.getString(cursor.getColumnIndex("cost_title"));

costBean.costDate = cursor.getString(cursor.getColumnIndex("cost_date"));

costBean.costMoney = cursor.getString(cursor.getColumnIndex("cost_money"));

mCostBeanList.add(costBean);

}

cursor.close();

}这里获取不了cost_money的准确列数,所以需要改成如下形式。

if (cursor != null) {

while (cursor.moveToNext()) {

CostBean costBean = new CostBean();

int dataColumnIndex = cursor.getColumnIndex("cost_title");

costBean.costTitle = cursor.getString(dataColumnIndex + 0);

costBean.costDate = cursor.getString(dataColumnIndex + 1);

costBean.costMoney = cursor.getString(dataColumnIndex + 2);

mCostBeanList.add(costBean);

}

cursor.close();

}这里是以cost_title为基准列数,向后退出cost_date和cost_money的列数。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/912723
推荐阅读
相关标签
  

闽ICP备14008679号