課程
/移動開發(fā)
/Android
/Android-節(jié)日短信送祝福(功能篇)
有沒有人遇到發(fā)送完短信切換到發(fā)送記錄就一直顯示一個progressBar,并沒有顯示發(fā)送記錄?
2015-12-28
源自:Android-節(jié)日短信送祝福(功能篇) 2-6
正在回答
1、確認(rèn)是否寫入了數(shù)據(jù)庫,可以通過命令行看
2、數(shù)據(jù)寫入數(shù)據(jù)庫了,沒有顯示出來(也是我遇到的問題),原因是SmsProvider中的query寫錯了,正確的應(yīng)該是:
@Nullable @Override public?Cursor?query(Uri?uri,?String[]?projection,?String?selection,?String[]?selectionArgs,?String?sortOrder)?{ ????int?match?=?matcher.match(uri); ????switch?(match)?{ ????????case?SMS_ALL: ????????????break; ????????case?SMS_ONE: ????????????long?id?=?ContentUris.parseId(uri); ????????????selection?=?"_id=?"; ????????????selectionArgs?=?new?String[]{String.valueOf(id)}; ????????????break; ????????default: ????????????throw?new?RSIllegalArgumentException("Wrong?URI:"?+?uri); ????} ????mDb?=?mHelper.getReadableDatabase(); ????Cursor?cursor?=?mDb.query(SendedMsg.TABLE_NAME,?projection,?selection,?selectionArgs,?null,?null,?sortOrder); ????cursor.setNotificationUri(getContext().getContentResolver(),?URI_SMS_ALL); ????//cursor.close(); ????return?cursor; }
注意最后兩行代碼
botao555 提問者
newView和bindView沒有被調(diào)用是為什么?
mCursorAdapter?=?new?CursorAdapter(getActivity(),?null,?false)?{ ????@Override ????public?View?newView(Context?context,?Cursor?cursor,?ViewGroup?parent)?{ ????????Log.e("CBT",?"newView-->"); ????????View?view?=?mInflater.inflate(R.layout.item_sended_msg,?parent,?false); ????????return?view; ????} ????@Override ????public?void?bindView(View?view,?Context?context,?Cursor?cursor)?{ ????????Log.e("CBT",?"bindView-->"); ????????TextView?msg?=?(TextView)?view.findViewById(R.id.id_tv_msg); ????????FlowLayout?fl?=?(FlowLayout)?view.findViewById(R.id.id_fl_contacts); ????????TextView?fes?=?(TextView)?view.findViewById(R.id.id_tv_fes); ????????TextView?date?=?(TextView)?view.findViewById(R.id.id_tv_date); ????????msg.setText(cursor.getString(cursor.getColumnIndex(SendedMsg.COLUMN_MSG))); ????????fes.setText(cursor.getString(cursor.getColumnIndex(SendedMsg.COLUMN_FES_NAME))); ????????date.setText(cursor.getString(cursor.getColumnIndex(SendedMsg.COLUMN_DATE))); ????????String?names?=?cursor.getString(cursor.getColumnIndex(SendedMsg.COLUMN_NAMES)); ????????Log.e("CBT","namesBefore-->"+names); ????????if?(TextUtils.isEmpty(names))?{ ????????????return; ????????} ????????Log.e("CBT","namesAfter-->"+names); ????????fl.removeAllViews(); ????????for?(String?name?:?names.split(":"))?{ ????????????addTag(name,fl); ????????} ????} };
舉報
本課程將帶領(lǐng)大家實現(xiàn)一個節(jié)日短信的應(yīng)用,此課程為續(xù)集
1 回答數(shù)據(jù)庫保存不了,發(fā)送記錄沒有,請同學(xué)老師幫個忙看一下
1 回答發(fā)送短信的時候出錯了
1 回答節(jié)日短信送祝福
1 回答怎么給自己發(fā)短信?
1 回答關(guān)于ContentProvider中已經(jīng)提供了獲取數(shù)據(jù)的方法,為什么在使用Loader加載的時候沒有使用到?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-02-20
1、確認(rèn)是否寫入了數(shù)據(jù)庫,可以通過命令行看
2、數(shù)據(jù)寫入數(shù)據(jù)庫了,沒有顯示出來(也是我遇到的問題),原因是SmsProvider中的query寫錯了,正確的應(yīng)該是:
注意最后兩行代碼
2015-12-28
newView和bindView沒有被調(diào)用是為什么?