Fetching Image from firebase using Picasso











up vote
0
down vote

favorite
1












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.










share|improve this question




























    up vote
    0
    down vote

    favorite
    1












    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.










    share|improve this question


























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      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.










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 15 hours ago

























      asked 16 hours ago









      itz Prateek

      107




      107
























          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





          share|improve this answer





















          • 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











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          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
































          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





          share|improve this answer





















          • 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















          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





          share|improve this answer





















          • 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













          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





          share|improve this answer












          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






          share|improve this answer












          share|improve this answer



          share|improve this answer










          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


















          • 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


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          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




















































































          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()