[問題] 非SQLite datasource 的ContentProvider?

看板AndroidDev作者 (程式猿)時間12年前 (2013/03/21 02:22), 編輯推噓2(201)
留言3則, 2人參與, 最新討論串1/1
書上&網路上說 ContentProvider沒有規定資料來源的實作 也就是並非SQLite不可 但是沒有講怎麼做 昨天整理(硬幹)出一個方法 請問還有更... 正統的解法嗎: 1. 繼承AbstractCursor實現自己Cursor,然後把資料放在裡面回傳 2. 改寫MyCursor 以下的Method getColumnNames() getCount() 3. 到ContentProvider修改query method,直接將資料塞進MyCursor物件 廢話比較多的網誌排版版本 無廣告 http://tinyurl.com/cb93ewm -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.165.194.18

03/21 11:05, , 1F
好奇你的需求,想上別的db?
03/21 11:05, 1F
是的 或者說非資料庫的datasource

03/21 12:06, , 2F
用MatrixCursor
03/21 12:06, 2F

03/21 12:07, , 3F
用AbstractCursor是對的 但是太耗功夫了 有人幫你做好了
03/21 12:07, 3F
這個好 這個好 ~ ※ 編輯: codemonkey 來自: 118.165.194.18 (03/21 16:15)
文章代碼(AID): #1HIcxc9k (AndroidDev)