android - Firebase database data retrieving -
`i retrying data "news" shown in screen shot , same procedure trying retrieve from"info" in android showing data news not info have tried lot, unable solve please help.
i'm doing this:
databasereference minfo= firebasedatabase.getinstance().getreference().child("info"); databasereference mdatabase= firebasedatabase.getinstance().getreference().child("news");
it working news, not info.
code here `
import android.os.bundle; import android.support.v4.app.fragment; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.textview; import com.firebase.ui.database.firebaserecycleradapter; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; /** * created hp india on 08-apr-17. */ public class fragmentone extends fragment { public fragmentone() {} private recyclerview minfolists; private databasereference mdatabase; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { final view rootview = inflater.inflate(r.layout.tab_one, container, false); super.oncreate(savedinstancestate); minfolists=(recyclerview)rootview.findviewbyid(r.id.minfolists); mdatabase= firebasedatabase.getinstance().getreference().child("info"); mdatabase.keepsynced(true); linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(getactivity()); linearlayoutmanager.setreverselayout(true); linearlayoutmanager.setstackfromend(true); minfolists.sethasfixedsize(true); minfolists.setitemviewcachesize(20); minfolists.setdrawingcacheenabled(true); minfolists.setdrawingcachequality(view.drawing_cache_quality_auto); minfolists.setlayoutmanager(linearlayoutmanager); firebaserecycleradapter<orginfo,orginfoviewholder> firebaserecycleradapter=new firebaserecycleradapter<orginfo,orginfoviewholder>( orginfo.class, r.layout.home_list_item, orginfoviewholder.class, mdatabase ){ @override protected void populateviewholder(orginfoviewholder viewholder, orginfo model, int position) { viewholder.settitle(model.gettitle()); viewholder.setdesc(model.getdescription()); } }; minfolists.setadapter(firebaserecycleradapter); return rootview; } public static class orginfoviewholder extends recyclerview.viewholder { view mview; public orginfoviewholder(view itemview) { super(itemview); mview=itemview; } public void settitle(string title) { textview post_title=(textview)mview.findviewbyid(r.id.name); post_title.settext(title); } public void setdesc(string desc) { textview post_title=(textview)mview.findviewbyid(r.id.address); post_title.settext(desc); } }
`
this how showing data. news section code working , info it's not
Comments
Post a Comment