Home > Mobile >  Issue with setText while getting data from firebase
Issue with setText while getting data from firebase

Time:06-03

Okay I have 2000 quotes in firebase what I'm doing is there are two buttons first & latest as the name suggests when I click 'first' it's showing the first data from the firebase in the logs and the same for the 'latest' when I click it its getting and showing the latest data from firebase in the logs

but the issue is when I'm trying to setText it's showing a random quote and I don't know what should I do

I asked this previous question about how to get the first and last data from firebase and I get an answer too but the issue is I'm not able to setText the correct data

 private void latestQuote() {
        DatabaseReference db = FirebaseDatabase.getInstance().getReference();
        DatabaseReference quotesRef = db.child("Quotes");
        Query queryForFirstElement = quotesRef.orderByKey().limitToLast(1); //           
  • Related