Fetching Image from firebase using Picasso
up vote
0
down vote
favorite
I have done with the text feteching from the database, buit while fetching image from the database using picasso the images are not loading the phone and the logcat is displaying the error :
com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
The textviews are easily getting fetching from the firebase. But in case of ImageView its not loading properly.
QuoteList.java
public class QuoteList extends AppCompatActivity {
private StorageReference storageRef;
RecyclerView mRecyclerView;
FirebaseDatabase mFirebaseDatabase;
DatabaseReference mReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote_list);
//ActionBar actionBar = getSupportActionBar();
//getSupportActionBar().setTitle("Quotes");
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//getSupportActionBar().setHomeButtonEnabled(true);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView = findViewById(R.id.quotes_list);
mRecyclerView.setLayoutManager(layoutManager);
mFirebaseDatabase = FirebaseDatabase.getInstance();
mReference = mFirebaseDatabase.getReference("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.setDetails(getApplicationContext(), model.getQuotes(), model.getQuote_Author(), model.getImages());
viewHolder.setQuotes(model.getQuotes());
viewHolder.setQuoteAuthor(model.getQuote_Author());
viewHolder.setImage(getApplicationContext(),model.getImages());
}
};
mRecyclerView.setAdapter(firebaseRecyclerAdapter);
}
public static 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.get().load(image).into(post_image);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
}
}
I am also attaching the logcat error report. Please go through it.
11-04 16:16:37.413 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:39.547 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:40.567 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:41.948 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:44.661 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:48.528 6688-7603/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:24:46.716 6688-6698/com.example.lenovo.skanda E/System: Uncaught exception thrown by finalizer
11-04 16:24:46.717 6688-6698/com.example.lenovo.skanda E/System: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
11-04 16:24:46.718 6688-6698/com.example.lenovo.skanda E/System: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Please help me out. Thank you in advance.
java android firebase firebase-storage picasso
add a comment |
up vote
0
down vote
favorite
I have done with the text feteching from the database, buit while fetching image from the database using picasso the images are not loading the phone and the logcat is displaying the error :
com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
The textviews are easily getting fetching from the firebase. But in case of ImageView its not loading properly.
QuoteList.java
public class QuoteList extends AppCompatActivity {
private StorageReference storageRef;
RecyclerView mRecyclerView;
FirebaseDatabase mFirebaseDatabase;
DatabaseReference mReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote_list);
//ActionBar actionBar = getSupportActionBar();
//getSupportActionBar().setTitle("Quotes");
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//getSupportActionBar().setHomeButtonEnabled(true);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView = findViewById(R.id.quotes_list);
mRecyclerView.setLayoutManager(layoutManager);
mFirebaseDatabase = FirebaseDatabase.getInstance();
mReference = mFirebaseDatabase.getReference("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.setDetails(getApplicationContext(), model.getQuotes(), model.getQuote_Author(), model.getImages());
viewHolder.setQuotes(model.getQuotes());
viewHolder.setQuoteAuthor(model.getQuote_Author());
viewHolder.setImage(getApplicationContext(),model.getImages());
}
};
mRecyclerView.setAdapter(firebaseRecyclerAdapter);
}
public static 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.get().load(image).into(post_image);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
}
}
I am also attaching the logcat error report. Please go through it.
11-04 16:16:37.413 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:39.547 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:40.567 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:41.948 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:44.661 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:48.528 6688-7603/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:24:46.716 6688-6698/com.example.lenovo.skanda E/System: Uncaught exception thrown by finalizer
11-04 16:24:46.717 6688-6698/com.example.lenovo.skanda E/System: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
11-04 16:24:46.718 6688-6698/com.example.lenovo.skanda E/System: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Please help me out. Thank you in advance.
java android firebase firebase-storage picasso
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have done with the text feteching from the database, buit while fetching image from the database using picasso the images are not loading the phone and the logcat is displaying the error :
com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
The textviews are easily getting fetching from the firebase. But in case of ImageView its not loading properly.
QuoteList.java
public class QuoteList extends AppCompatActivity {
private StorageReference storageRef;
RecyclerView mRecyclerView;
FirebaseDatabase mFirebaseDatabase;
DatabaseReference mReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote_list);
//ActionBar actionBar = getSupportActionBar();
//getSupportActionBar().setTitle("Quotes");
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//getSupportActionBar().setHomeButtonEnabled(true);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView = findViewById(R.id.quotes_list);
mRecyclerView.setLayoutManager(layoutManager);
mFirebaseDatabase = FirebaseDatabase.getInstance();
mReference = mFirebaseDatabase.getReference("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.setDetails(getApplicationContext(), model.getQuotes(), model.getQuote_Author(), model.getImages());
viewHolder.setQuotes(model.getQuotes());
viewHolder.setQuoteAuthor(model.getQuote_Author());
viewHolder.setImage(getApplicationContext(),model.getImages());
}
};
mRecyclerView.setAdapter(firebaseRecyclerAdapter);
}
public static 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.get().load(image).into(post_image);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
}
}
I am also attaching the logcat error report. Please go through it.
11-04 16:16:37.413 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:39.547 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:40.567 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:41.948 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:44.661 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:48.528 6688-7603/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:24:46.716 6688-6698/com.example.lenovo.skanda E/System: Uncaught exception thrown by finalizer
11-04 16:24:46.717 6688-6698/com.example.lenovo.skanda E/System: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
11-04 16:24:46.718 6688-6698/com.example.lenovo.skanda E/System: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Please help me out. Thank you in advance.
java android firebase firebase-storage picasso
I have done with the text feteching from the database, buit while fetching image from the database using picasso the images are not loading the phone and the logcat is displaying the error :
com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
The textviews are easily getting fetching from the firebase. But in case of ImageView its not loading properly.
QuoteList.java
public class QuoteList extends AppCompatActivity {
private StorageReference storageRef;
RecyclerView mRecyclerView;
FirebaseDatabase mFirebaseDatabase;
DatabaseReference mReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote_list);
//ActionBar actionBar = getSupportActionBar();
//getSupportActionBar().setTitle("Quotes");
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//getSupportActionBar().setHomeButtonEnabled(true);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView = findViewById(R.id.quotes_list);
mRecyclerView.setLayoutManager(layoutManager);
mFirebaseDatabase = FirebaseDatabase.getInstance();
mReference = mFirebaseDatabase.getReference("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.setDetails(getApplicationContext(), model.getQuotes(), model.getQuote_Author(), model.getImages());
viewHolder.setQuotes(model.getQuotes());
viewHolder.setQuoteAuthor(model.getQuote_Author());
viewHolder.setImage(getApplicationContext(),model.getImages());
}
};
mRecyclerView.setAdapter(firebaseRecyclerAdapter);
}
public static 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.get().load(image).into(post_image);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
}
}
I am also attaching the logcat error report. Please go through it.
11-04 16:16:37.413 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:39.547 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:40.567 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:41.948 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:44.661 6688-7596/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:16:48.528 6688-7603/com.example.lenovo.skanda E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
11-04 16:24:46.716 6688-6698/com.example.lenovo.skanda E/System: Uncaught exception thrown by finalizer
11-04 16:24:46.717 6688-6698/com.example.lenovo.skanda E/System: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
11-04 16:24:46.718 6688-6698/com.example.lenovo.skanda E/System: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.org.conscrypt.SslWrapper.isClosed()' on a null object reference
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.free(ConscryptFileDescriptorSocket.java:986)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.finalize(ConscryptFileDescriptorSocket.java:1014)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
Please help me out. Thank you in advance.
java android firebase firebase-storage picasso
java android firebase firebase-storage picasso
edited 15 hours ago
asked 16 hours ago
itz Prateek
107
107
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
-1
down vote
You storage security rules probably have an
allow write: if request.auth !=null
clause and here you don't seem to be using FirebaseAuth to authenticate the user.
For testing, is suggest you use signInAnonymously() method and sign the user transparently before writing to the storage.
FirebaseAuth mAuth = FirebaseAuth.getInstance();
Then in sign in before doing any of the stuff that you are doing
FirebaseUser user = mAuth.getCurrentUser();
if (user != null) {
// do your stuff
} else {
signInAnonymously();
}
signInAnonymously() method is as follows
private void signInAnonymously(){
mAuth.signInAnonymously().addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
@Override public void onSuccess(AuthResult authResult) {
// do your stuff
}
}) .addOnFailureListener(this, new OnFailureListener() {
@Override public void onFailure(@NonNull Exception exception) {
Log.e("TAG", "signInAnonymously:FAILURE", exception);
}
});
}
Also in the Firebase console, under authentication> signin methods, enable anonymous sign in
This may solve your problem
Alternatively if you don't want authentication for testing have the rules as:
allow write: if true;
DO THIS ONLY FOR TESTING AS THIS IS BASICALLY PUBLIC ACCESS
Then you can adjust your authentication approach according to your rules.
If your rules are not what i specified, please share your rules so that we can guide you accordingly rather than speculating and guessing
Initially I put the rules as: allow read, write; After adding allow write: if true; The images are still not loading the console
– itz Prateek
15 hours ago
Did you get the same error?
– Vishal Sharma
15 hours ago
Yes.. I have edit the query above. Please go through the logcat.
– itz Prateek
15 hours ago
earlier i have used allow write: if request.auth !=null.. But after that my Progress bar keep on moving.
– itz Prateek
15 hours ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
-1
down vote
You storage security rules probably have an
allow write: if request.auth !=null
clause and here you don't seem to be using FirebaseAuth to authenticate the user.
For testing, is suggest you use signInAnonymously() method and sign the user transparently before writing to the storage.
FirebaseAuth mAuth = FirebaseAuth.getInstance();
Then in sign in before doing any of the stuff that you are doing
FirebaseUser user = mAuth.getCurrentUser();
if (user != null) {
// do your stuff
} else {
signInAnonymously();
}
signInAnonymously() method is as follows
private void signInAnonymously(){
mAuth.signInAnonymously().addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
@Override public void onSuccess(AuthResult authResult) {
// do your stuff
}
}) .addOnFailureListener(this, new OnFailureListener() {
@Override public void onFailure(@NonNull Exception exception) {
Log.e("TAG", "signInAnonymously:FAILURE", exception);
}
});
}
Also in the Firebase console, under authentication> signin methods, enable anonymous sign in
This may solve your problem
Alternatively if you don't want authentication for testing have the rules as:
allow write: if true;
DO THIS ONLY FOR TESTING AS THIS IS BASICALLY PUBLIC ACCESS
Then you can adjust your authentication approach according to your rules.
If your rules are not what i specified, please share your rules so that we can guide you accordingly rather than speculating and guessing
Initially I put the rules as: allow read, write; After adding allow write: if true; The images are still not loading the console
– itz Prateek
15 hours ago
Did you get the same error?
– Vishal Sharma
15 hours ago
Yes.. I have edit the query above. Please go through the logcat.
– itz Prateek
15 hours ago
earlier i have used allow write: if request.auth !=null.. But after that my Progress bar keep on moving.
– itz Prateek
15 hours ago
add a comment |
up vote
-1
down vote
You storage security rules probably have an
allow write: if request.auth !=null
clause and here you don't seem to be using FirebaseAuth to authenticate the user.
For testing, is suggest you use signInAnonymously() method and sign the user transparently before writing to the storage.
FirebaseAuth mAuth = FirebaseAuth.getInstance();
Then in sign in before doing any of the stuff that you are doing
FirebaseUser user = mAuth.getCurrentUser();
if (user != null) {
// do your stuff
} else {
signInAnonymously();
}
signInAnonymously() method is as follows
private void signInAnonymously(){
mAuth.signInAnonymously().addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
@Override public void onSuccess(AuthResult authResult) {
// do your stuff
}
}) .addOnFailureListener(this, new OnFailureListener() {
@Override public void onFailure(@NonNull Exception exception) {
Log.e("TAG", "signInAnonymously:FAILURE", exception);
}
});
}
Also in the Firebase console, under authentication> signin methods, enable anonymous sign in
This may solve your problem
Alternatively if you don't want authentication for testing have the rules as:
allow write: if true;
DO THIS ONLY FOR TESTING AS THIS IS BASICALLY PUBLIC ACCESS
Then you can adjust your authentication approach according to your rules.
If your rules are not what i specified, please share your rules so that we can guide you accordingly rather than speculating and guessing
Initially I put the rules as: allow read, write; After adding allow write: if true; The images are still not loading the console
– itz Prateek
15 hours ago
Did you get the same error?
– Vishal Sharma
15 hours ago
Yes.. I have edit the query above. Please go through the logcat.
– itz Prateek
15 hours ago
earlier i have used allow write: if request.auth !=null.. But after that my Progress bar keep on moving.
– itz Prateek
15 hours ago
add a comment |
up vote
-1
down vote
up vote
-1
down vote
You storage security rules probably have an
allow write: if request.auth !=null
clause and here you don't seem to be using FirebaseAuth to authenticate the user.
For testing, is suggest you use signInAnonymously() method and sign the user transparently before writing to the storage.
FirebaseAuth mAuth = FirebaseAuth.getInstance();
Then in sign in before doing any of the stuff that you are doing
FirebaseUser user = mAuth.getCurrentUser();
if (user != null) {
// do your stuff
} else {
signInAnonymously();
}
signInAnonymously() method is as follows
private void signInAnonymously(){
mAuth.signInAnonymously().addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
@Override public void onSuccess(AuthResult authResult) {
// do your stuff
}
}) .addOnFailureListener(this, new OnFailureListener() {
@Override public void onFailure(@NonNull Exception exception) {
Log.e("TAG", "signInAnonymously:FAILURE", exception);
}
});
}
Also in the Firebase console, under authentication> signin methods, enable anonymous sign in
This may solve your problem
Alternatively if you don't want authentication for testing have the rules as:
allow write: if true;
DO THIS ONLY FOR TESTING AS THIS IS BASICALLY PUBLIC ACCESS
Then you can adjust your authentication approach according to your rules.
If your rules are not what i specified, please share your rules so that we can guide you accordingly rather than speculating and guessing
You storage security rules probably have an
allow write: if request.auth !=null
clause and here you don't seem to be using FirebaseAuth to authenticate the user.
For testing, is suggest you use signInAnonymously() method and sign the user transparently before writing to the storage.
FirebaseAuth mAuth = FirebaseAuth.getInstance();
Then in sign in before doing any of the stuff that you are doing
FirebaseUser user = mAuth.getCurrentUser();
if (user != null) {
// do your stuff
} else {
signInAnonymously();
}
signInAnonymously() method is as follows
private void signInAnonymously(){
mAuth.signInAnonymously().addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
@Override public void onSuccess(AuthResult authResult) {
// do your stuff
}
}) .addOnFailureListener(this, new OnFailureListener() {
@Override public void onFailure(@NonNull Exception exception) {
Log.e("TAG", "signInAnonymously:FAILURE", exception);
}
});
}
Also in the Firebase console, under authentication> signin methods, enable anonymous sign in
This may solve your problem
Alternatively if you don't want authentication for testing have the rules as:
allow write: if true;
DO THIS ONLY FOR TESTING AS THIS IS BASICALLY PUBLIC ACCESS
Then you can adjust your authentication approach according to your rules.
If your rules are not what i specified, please share your rules so that we can guide you accordingly rather than speculating and guessing
answered 16 hours ago
Vishal Sharma
7452212
7452212
Initially I put the rules as: allow read, write; After adding allow write: if true; The images are still not loading the console
– itz Prateek
15 hours ago
Did you get the same error?
– Vishal Sharma
15 hours ago
Yes.. I have edit the query above. Please go through the logcat.
– itz Prateek
15 hours ago
earlier i have used allow write: if request.auth !=null.. But after that my Progress bar keep on moving.
– itz Prateek
15 hours ago
add a comment |
Initially I put the rules as: allow read, write; After adding allow write: if true; The images are still not loading the console
– itz Prateek
15 hours ago
Did you get the same error?
– Vishal Sharma
15 hours ago
Yes.. I have edit the query above. Please go through the logcat.
– itz Prateek
15 hours ago
earlier i have used allow write: if request.auth !=null.. But after that my Progress bar keep on moving.
– itz Prateek
15 hours ago
Initially I put the rules as: allow read, write; After adding allow write: if true; The images are still not loading the console
– itz Prateek
15 hours ago
Initially I put the rules as: allow read, write; After adding allow write: if true; The images are still not loading the console
– itz Prateek
15 hours ago
Did you get the same error?
– Vishal Sharma
15 hours ago
Did you get the same error?
– Vishal Sharma
15 hours ago
Yes.. I have edit the query above. Please go through the logcat.
– itz Prateek
15 hours ago
Yes.. I have edit the query above. Please go through the logcat.
– itz Prateek
15 hours ago
earlier i have used allow write: if request.auth !=null.. But after that my Progress bar keep on moving.
– itz Prateek
15 hours ago
earlier i have used allow write: if request.auth !=null.. But after that my Progress bar keep on moving.
– itz Prateek
15 hours ago
add a comment |
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
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139666%2ffetching-image-from-firebase-using-picasso%23new-answer', 'question_page');
}
);
Post as a guest
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
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
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