Answer the question
In order to leave comments, you need to log in
How to get url from firebase database?
There is such a Firebase database:
Authorization removed, full access to data. Wrote like this and got stuck...
public void onClick(View view) {
// [START initialize_database_ref]
mDatabase = FirebaseDatabase.getInstance().getReference();
// [END initialize_database_ref]
ValueEventListener bookListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
// Загружаем картинку
Picasso.with(this)
.load(coverUrl)
.into(mImageView);
Answer the question
In order to leave comments, you need to log in
Helped on another resource, I publish the answer:
public void onClick(View view) {
// [START initialize_database_ref]
ref = FirebaseDatabase.getInstance().getReference().child("books").child("book_1");
// [END initialize_database_ref]
ValueEventListener bookListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String url = dataSnapshot.child("coverUrl").getValue(String.class);
// Загружаем картинку
Picasso.with(MainActivity.this)
.load(url)
.into(mImageView);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
//вешаем наш слушатель на нашу ссылку
ref.addValueEventListener(bookListener);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question