android - Firebase equalTo() couldn't work correctly -


i'm developing android app following firebase database table:

"fav" : { "-ktf0tmshj48-oh76or3" : {   "article" : {},   "articleid" : "1005",   "id" : 1505034214723,   "userid" : "xudklm4vmfa9fjva15xvlikykfa3",   "userid_articleid" : "xudklm4vmfa9fjva15xvlikykfa31005" }, "-ktf13bfglsb4sfhhv-p" : {   "article" : {},   "articleid" : "1001",   "id" : 1505034257363,   "userid" : "xudklm4vmfa9fjva15xvlikykfa3",   "userid_articleid" : "xudklm4vmfa9fjva15xvlikykfa31001" } } 

i want query string "userid_articleid" this:

firebasedatabase.getinstance().getreference().child("fav").orderbychild("userid_articleid").equalto(firebaseuser.getuid() + article.id)             .addlistenerforsinglevalueevent(new valueeventlistener() {         @override         public void ondatachange(datasnapshot datasnapshot) {             if (datasnapshot.exists()){                 (datasnapshot data : datasnapshot.getchildren()){                     fav = data.getvalue(fav.class);                     favkey = data.getkey();                     staritem.seticon(r.drawable.star);                 }             }         }          @override         public void oncancelled(databaseerror databaseerror) {             log.i("fyales","the datachanged");         }     }); } 

but can't object wanted, weirdest thing can object want correctly key "articleid" or "id". can work if if give definite value "xudkl" "userid_articleid" if "userid_articleid" in database value "xudkl" this:

.orderbychild("xudkl").add.... 

but can't work if give value "xudklm4vmfa9f" "userid_articleid" if "userid_articleid" in database "xudklm4vmfa9f" this.

orderbychild("xudklm4vmfa9f").add... 

i don't know why.it related length of string or it's bug in firebase ? appreciated.

i solved problem...the reason didn't keep data fresh . synced data before used them ref.keepsynced(true).you can answer in enabling offline capabilities on android.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -