首先,我從圖庫中選擇圖像,然後將其上傳到Firebase存儲,並在Book Node中存儲路徑以及有關Book的其他信息。如何通過在Firebase數據庫中使用圖像路徑來顯示圖像?
那麼如何獲取圖像並將其顯示在imageView中?
我的活動(我在做以獲得有關該書的其它信息):
ref = dataBD.getReference("books");
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot dataSnap : dataSnapshot.getChildren()) {
Book valueBook=dataSnap.getValue(Book.class);
String idBookDisplay=valueBook.getId_Book();
if(id_user.equals(idBookDisplay)){
String titreLivreToDisplay=valueBook.getNom_livre();
String descLivreToDisplay=valueBook.getDesc_livre();
String prixLivreToDisplay=valueBook.getPrix_livre();
String timeToDisplay=valueBook.getDate_creation();
Book item = new Book();
item.setNom_livre(titreLivreToDisplay);
item.setDesc_livre(descLivreToDisplay);
item.setPrix_livre(prixLivreToDisplay);
item.setDate_creation(timeToDisplay);
feedItems.add(item);
}
}
listAdapter = new FeedListAdapter(AccueilActivity.this,feedItems);
listView.setAdapter(listAdapter);
listAdapter.notifyDataSetChanged();
}
的ImageView的佈局文件:
<ImageView
android:id="@+id/book_picture_display"
android:layout_width="@dimen/feed_item_profile_pic"
android:layout_height="@dimen/feed_item_profile_pic"
android:scaleType="fitCenter" />
節點書籍:
我做到了,現在我的圖片的路徑是這樣的:'GS://book-...com//images/sport23- 03-2017_15:22:54',但我有一個錯誤:'StorageException發生了.Object在location.Code不存在:-13010 HttpResult:404' – Amal