Using Swipe View without tabs to switch to WebView using RecyclerView and Firebase in Android -
i have build application regarding news, in there different posts within recyclerview
. if user swipe left on post, take them webview
of post in explained news of post shown. problem not make happen.
i have implemented post layout recyclerview
, working fine. cant make swipe view can take me webview page , load related webpage in it.
i using firebase database. have researched many questions none of them worked me.please help.
i using android studio.
webview class firebaserecycler adapter:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.webview_page); webvieres = (recyclerview)findviewbyid(r.id.recycleweb); mdataref = firebasedatabase.getinstance().getreference().child("web"); webviewthis = (webview) findviewbyid(r.id.webview_news); webviewthis.setwebviewclient(new webviewclient()); webviewthis.getsettings().setjavascriptenabled(true); webviewthis.getsettings().setloadsimagesautomatically(true); } @override public void onstart() { super.onstart(); firebaserecycleradapter<post,postviewholder> firebaserecycleradapte = new firebaserecycleradapter<post,postviewholder>( post.class, r.layout.web_card, postviewholder.class, mdataref ) { @override protected void populateviewholder(postviewholder viewholder, post model, int position) { viewholder.setwebviewpost(model.getwebviewpost()); } }; webvieres.setadapter(firebaserecycleradapte); } public static class postviewholder extends recyclerview.viewholder { view mview; public postviewholder(view itemview) { super(itemview); mview = itemview; } public void setwebviewpost(string webviewpost) { webview post_web = (webview) mview.findviewbyid(r.id.webview_news); post_web.loadurl(webviewpost); } }
post class firebase adapter
firebaserecycleradapter <post, postviewholder> firebaserecycleradapter = new firebaserecycleradapter<post, postviewholder>( post.class, r.layout.post_row_recycle_home, postviewholder.class, mdatabasereference ) { @override protected void populateviewholder(postviewholder viewholder, post model, int position) { viewholder.settitle(model.gettitle()); viewholder.setsource(model.getsource()); } }; mrecyclerview.setadapter(firebaserecycleradapter); } public static class postviewholder extends recyclerviewpager.viewholder{ view mview; public postviewholder(view itemview) { super(itemview); mview = itemview; } public void settitle(string title){ textview post_title = (textview)mview.findviewbyid(r.id.title_cardview); post_title.settext(title); } public void setsource(string source){ textview post_source = (textview)mview.findviewbyid(r.id.source_cardview); post_source.settext(source); }
i want have swipe effect this:-
Comments
Post a Comment