第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

有沒有同學(xué)用Android Studio 3.0 做的?運行之后老是閃退,怎么解決?

有沒有同學(xué)用Android Studio 3.0 做的?運行之后老是閃退,怎么解決?

正在回答

3 回答

厲害啦

0 回復(fù) 有任何疑惑可以回復(fù)我~

你是真的牛逼

0 回復(fù) 有任何疑惑可以回復(fù)我~

解決了。

有兩個地方需要改。

  1. ?public Cursor getAllCostData() {
    ? ?SQLiteDatabase database = getWritableDatabase();
    ? ?return database.query("imooc_daily", null, null, null, null, null, "cost_date" +"ASC");
    }最后面的排序需要改成 "cost_date ASC"

  2. 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的準(zhǔn)確列數(shù),所以需要改成如下形式。

????????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為基準(zhǔn)列數(shù),向后退出cost_date和cost_money的列數(shù)。

7 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
Android記賬本
  • 參與學(xué)習(xí)       18802    人
  • 解答問題       60    個

本課程是一個案例課程,主要講解第三方庫圖標(biāo)和數(shù)據(jù)庫的結(jié)合使用

進入課程

有沒有同學(xué)用Android Studio 3.0 做的?運行之后老是閃退,怎么解決?

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號