iT邦幫忙

1

要怎麼從firebase截取資料到android studio?

剛學android studio、 firebase而已 別講太深的感恩..
網上看了一個firebase截取資料程式碼教學,可是怎樣都跑不出來
程式碼是沒有error,只是執行app時是空白
請問是哪裡要修正呢?
這我firebase資料 (規則都有改true)
https://ithelp.ithome.com.tw/upload/images/20181021/20110726o83FsV1QYk.png

下面是我xml檔、java檔
https://ithelp.ithome.com.tw/upload/images/20181021/20110726iNVhx4cKJn.pnghttps://ithelp.ithome.com.tw/upload/images/20181021/20110726Br0olWE3qH.pnghttps://ithelp.ithome.com.tw/upload/images/20181021/20110726je6jg7968r.png

現在我是剛開始學firebase 請問有沒有哪邊有適合初學者的網站?
因為我看很多教學都只跟你講程式碼什麼,常常照打又不知道哪裡有錯
有沒有從零做到好的教學影片之類的呢..

黃彥儒 iT邦高手 1 級 ‧ 2018-10-21 18:48:55 檢舉
你要去對照FireBase文件,基本上這種東西只要有物件導向的概念後就是照他給你的介面操作。
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
最佳解答

你的資料庫沒有contacts的key

所以取根時無法取得內容

請幫資料庫新增contacts的key

舉例像是這樣 :
https://ithelp.ithome.com.tw/upload/images/20181022/20111102lwD0xQ4ogv.png
這是我的資料庫內容
新增了一個 sample的內容 再往裡面去新增資料

程式碼內需要指定到sample
https://ithelp.ithome.com.tw/upload/images/20181022/20111102Dnjj9nNDAI.png
像這樣子 最後結果就可以取得資料囉
https://ithelp.ithome.com.tw/upload/images/20181022/20111102g7F77lKZRE.png

leo840015 iT邦新手 5 級 ‧ 2018-10-23 00:47:32 檢舉

成功囉 非常感謝:)

0
ant1017
iT邦新手 2 級 ‧ 2018-10-22 14:37:50

你可以用Debug跑一遍看看,看你程式有沒有進到你要的功能裡。

我要發表回答

立即登入回答