How to retrieve data from firebase database in android

Multi tool use
up vote
0
down vote
favorite
Retrieving images from Firebase does not work? Hi I am working on upload and retrieve images from Firebase. I have successfully done the uploading part, but while doing for the retrieving one. I have came across a problem where i am unable to fetch image from Firebase. I am using Picasso version: 2.5.2
QuoteList.java
public class QuoteList extends AppCompatActivity
private StorageReference storageRef;
private RecyclerView mRecyclerView;
private DatabaseReference mReference;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote_list);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView = findViewById(R.id.quotes_list);
mRecyclerView.setLayoutManager(layoutManager);
mReference = FirebaseDatabase.getInstance().getReference().child("Quotes");
@Override
protected void onStart()
super.onStart();
FirebaseRecyclerAdapter<Quote, QuoteViewHolder> firebaseRecyclerAdapter =
new FirebaseRecyclerAdapter<Quote, QuoteViewHolder>(
Quote.class,
R.layout.quote_row,
QuoteViewHolder.class,
mReference
)
@Override
protected void populateViewHolder(QuoteViewHolder viewHolder , Quote model , int position)
viewHolder.setQuotes(model.getQuotes());
viewHolder.setQuoteAuthor(model.getQuote_Author());
viewHolder.setImage(getApplicationContext(),model.getImages());
;
mRecyclerView.setAdapter(firebaseRecyclerAdapter);
public class QuoteViewHolder extends RecyclerView.ViewHolder
View mView;
public QuoteViewHolder(View itemView)
super(itemView);
mView = itemView;
public void setQuotes(String Quote)
TextView post_quote = (TextView) mView.findViewById(R.id.post_quote);
post_quote.setText(Quote);
public void setQuoteAuthor(String QuoteAuthor)
TextView post_quoteAuthor = (TextView) mView.findViewById(R.id.post_author);
post_quoteAuthor.setText(QuoteAuthor);
public void setImage(Context ctx, String image)
ImageView post_image = (ImageView) mView.findViewById(R.id.post_image);
Picasso.with(ctx).load(image).into(post_image);
@Override
public boolean onCreateOptionsMenu(Menu menu)
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
For reference i have used a Youtube Link.



|
show 1 more comment
up vote
0
down vote
favorite
Retrieving images from Firebase does not work? Hi I am working on upload and retrieve images from Firebase. I have successfully done the uploading part, but while doing for the retrieving one. I have came across a problem where i am unable to fetch image from Firebase. I am using Picasso version: 2.5.2
QuoteList.java
public class QuoteList extends AppCompatActivity
private StorageReference storageRef;
private RecyclerView mRecyclerView;
private DatabaseReference mReference;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote_list);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView = findViewById(R.id.quotes_list);
mRecyclerView.setLayoutManager(layoutManager);
mReference = FirebaseDatabase.getInstance().getReference().child("Quotes");
@Override
protected void onStart()
super.onStart();
FirebaseRecyclerAdapter<Quote, QuoteViewHolder> firebaseRecyclerAdapter =
new FirebaseRecyclerAdapter<Quote, QuoteViewHolder>(
Quote.class,
R.layout.quote_row,
QuoteViewHolder.class,
mReference
)
@Override
protected void populateViewHolder(QuoteViewHolder viewHolder , Quote model , int position)
viewHolder.setQuotes(model.getQuotes());
viewHolder.setQuoteAuthor(model.getQuote_Author());
viewHolder.setImage(getApplicationContext(),model.getImages());
;
mRecyclerView.setAdapter(firebaseRecyclerAdapter);
public class QuoteViewHolder extends RecyclerView.ViewHolder
View mView;
public QuoteViewHolder(View itemView)
super(itemView);
mView = itemView;
public void setQuotes(String Quote)
TextView post_quote = (TextView) mView.findViewById(R.id.post_quote);
post_quote.setText(Quote);
public void setQuoteAuthor(String QuoteAuthor)
TextView post_quoteAuthor = (TextView) mView.findViewById(R.id.post_author);
post_quoteAuthor.setText(QuoteAuthor);
public void setImage(Context ctx, String image)
ImageView post_image = (ImageView) mView.findViewById(R.id.post_image);
Picasso.with(ctx).load(image).into(post_image);
@Override
public boolean onCreateOptionsMenu(Menu menu)
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
For reference i have used a Youtube Link.



This demo is, how to fetch firebase data in RecycleView? try this, Hope It's helpful for you. Thank You. github.com/chetanmahajan850/RecycleviewDemo
– chetan mahajan
Nov 9 at 5:40
What doesmodel.getImages()
return? Please responde with @.
– Alex Mamo
Nov 9 at 11:03
@alex it will reference to a another class called Quote.java where i used gettter setter and constructor.
– itz Prateek
Nov 9 at 15:53
@itzPrateek It is or it is not returning the desired url?
– Alex Mamo
Nov 9 at 15:55
no it wasn't @AlexMamo
– itz Prateek
Nov 9 at 18:17
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Retrieving images from Firebase does not work? Hi I am working on upload and retrieve images from Firebase. I have successfully done the uploading part, but while doing for the retrieving one. I have came across a problem where i am unable to fetch image from Firebase. I am using Picasso version: 2.5.2
QuoteList.java
public class QuoteList extends AppCompatActivity
private StorageReference storageRef;
private RecyclerView mRecyclerView;
private DatabaseReference mReference;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote_list);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView = findViewById(R.id.quotes_list);
mRecyclerView.setLayoutManager(layoutManager);
mReference = FirebaseDatabase.getInstance().getReference().child("Quotes");
@Override
protected void onStart()
super.onStart();
FirebaseRecyclerAdapter<Quote, QuoteViewHolder> firebaseRecyclerAdapter =
new FirebaseRecyclerAdapter<Quote, QuoteViewHolder>(
Quote.class,
R.layout.quote_row,
QuoteViewHolder.class,
mReference
)
@Override
protected void populateViewHolder(QuoteViewHolder viewHolder , Quote model , int position)
viewHolder.setQuotes(model.getQuotes());
viewHolder.setQuoteAuthor(model.getQuote_Author());
viewHolder.setImage(getApplicationContext(),model.getImages());
;
mRecyclerView.setAdapter(firebaseRecyclerAdapter);
public class QuoteViewHolder extends RecyclerView.ViewHolder
View mView;
public QuoteViewHolder(View itemView)
super(itemView);
mView = itemView;
public void setQuotes(String Quote)
TextView post_quote = (TextView) mView.findViewById(R.id.post_quote);
post_quote.setText(Quote);
public void setQuoteAuthor(String QuoteAuthor)
TextView post_quoteAuthor = (TextView) mView.findViewById(R.id.post_author);
post_quoteAuthor.setText(QuoteAuthor);
public void setImage(Context ctx, String image)
ImageView post_image = (ImageView) mView.findViewById(R.id.post_image);
Picasso.with(ctx).load(image).into(post_image);
@Override
public boolean onCreateOptionsMenu(Menu menu)
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
For reference i have used a Youtube Link.



Retrieving images from Firebase does not work? Hi I am working on upload and retrieve images from Firebase. I have successfully done the uploading part, but while doing for the retrieving one. I have came across a problem where i am unable to fetch image from Firebase. I am using Picasso version: 2.5.2
QuoteList.java
public class QuoteList extends AppCompatActivity
private StorageReference storageRef;
private RecyclerView mRecyclerView;
private DatabaseReference mReference;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote_list);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView = findViewById(R.id.quotes_list);
mRecyclerView.setLayoutManager(layoutManager);
mReference = FirebaseDatabase.getInstance().getReference().child("Quotes");
@Override
protected void onStart()
super.onStart();
FirebaseRecyclerAdapter<Quote, QuoteViewHolder> firebaseRecyclerAdapter =
new FirebaseRecyclerAdapter<Quote, QuoteViewHolder>(
Quote.class,
R.layout.quote_row,
QuoteViewHolder.class,
mReference
)
@Override
protected void populateViewHolder(QuoteViewHolder viewHolder , Quote model , int position)
viewHolder.setQuotes(model.getQuotes());
viewHolder.setQuoteAuthor(model.getQuote_Author());
viewHolder.setImage(getApplicationContext(),model.getImages());
;
mRecyclerView.setAdapter(firebaseRecyclerAdapter);
public class QuoteViewHolder extends RecyclerView.ViewHolder
View mView;
public QuoteViewHolder(View itemView)
super(itemView);
mView = itemView;
public void setQuotes(String Quote)
TextView post_quote = (TextView) mView.findViewById(R.id.post_quote);
post_quote.setText(Quote);
public void setQuoteAuthor(String QuoteAuthor)
TextView post_quoteAuthor = (TextView) mView.findViewById(R.id.post_author);
post_quoteAuthor.setText(QuoteAuthor);
public void setImage(Context ctx, String image)
ImageView post_image = (ImageView) mView.findViewById(R.id.post_image);
Picasso.with(ctx).load(image).into(post_image);
@Override
public boolean onCreateOptionsMenu(Menu menu)
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
For reference i have used a Youtube Link.






edited Nov 9 at 4:20
Rajendra
3516
3516
asked Nov 8 at 22:08


itz Prateek
279
279
This demo is, how to fetch firebase data in RecycleView? try this, Hope It's helpful for you. Thank You. github.com/chetanmahajan850/RecycleviewDemo
– chetan mahajan
Nov 9 at 5:40
What doesmodel.getImages()
return? Please responde with @.
– Alex Mamo
Nov 9 at 11:03
@alex it will reference to a another class called Quote.java where i used gettter setter and constructor.
– itz Prateek
Nov 9 at 15:53
@itzPrateek It is or it is not returning the desired url?
– Alex Mamo
Nov 9 at 15:55
no it wasn't @AlexMamo
– itz Prateek
Nov 9 at 18:17
|
show 1 more comment
This demo is, how to fetch firebase data in RecycleView? try this, Hope It's helpful for you. Thank You. github.com/chetanmahajan850/RecycleviewDemo
– chetan mahajan
Nov 9 at 5:40
What doesmodel.getImages()
return? Please responde with @.
– Alex Mamo
Nov 9 at 11:03
@alex it will reference to a another class called Quote.java where i used gettter setter and constructor.
– itz Prateek
Nov 9 at 15:53
@itzPrateek It is or it is not returning the desired url?
– Alex Mamo
Nov 9 at 15:55
no it wasn't @AlexMamo
– itz Prateek
Nov 9 at 18:17
This demo is, how to fetch firebase data in RecycleView? try this, Hope It's helpful for you. Thank You. github.com/chetanmahajan850/RecycleviewDemo
– chetan mahajan
Nov 9 at 5:40
This demo is, how to fetch firebase data in RecycleView? try this, Hope It's helpful for you. Thank You. github.com/chetanmahajan850/RecycleviewDemo
– chetan mahajan
Nov 9 at 5:40
What does
model.getImages()
return? Please responde with @.– Alex Mamo
Nov 9 at 11:03
What does
model.getImages()
return? Please responde with @.– Alex Mamo
Nov 9 at 11:03
@alex it will reference to a another class called Quote.java where i used gettter setter and constructor.
– itz Prateek
Nov 9 at 15:53
@alex it will reference to a another class called Quote.java where i used gettter setter and constructor.
– itz Prateek
Nov 9 at 15:53
@itzPrateek It is or it is not returning the desired url?
– Alex Mamo
Nov 9 at 15:55
@itzPrateek It is or it is not returning the desired url?
– Alex Mamo
Nov 9 at 15:55
no it wasn't @AlexMamo
– itz Prateek
Nov 9 at 18:17
no it wasn't @AlexMamo
– itz Prateek
Nov 9 at 18:17
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53216893%2fhow-to-retrieve-data-from-firebase-database-in-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
kev4,yOS9P7BtX hPUUo,mnjPuC,n2sJTVbCGSyjISLbjq0KcNow,jYV,AUEcGeZSA899,O6YhpaY,nlC
This demo is, how to fetch firebase data in RecycleView? try this, Hope It's helpful for you. Thank You. github.com/chetanmahajan850/RecycleviewDemo
– chetan mahajan
Nov 9 at 5:40
What does
model.getImages()
return? Please responde with @.– Alex Mamo
Nov 9 at 11:03
@alex it will reference to a another class called Quote.java where i used gettter setter and constructor.
– itz Prateek
Nov 9 at 15:53
@itzPrateek It is or it is not returning the desired url?
– Alex Mamo
Nov 9 at 15:55
no it wasn't @AlexMamo
– itz Prateek
Nov 9 at 18:17