android - Using the Position value of a recyclerview item to start another fragment -


i have recycler view different articles. can position of recyclerview item , still don't know how use position open article in full page/ activity.

here how manage position:

recyclerview.addonitemtouchlistener(new recycleritemclicklistener(this, recyclerview, new recycleritemclicklistener.onitemclicklistener() {     @override     public void onitemclick(view view, int position) {         toast.maketext(navigation.this, "" + position, toast.length_short).show();     }      @override     public void onitemlongclick(view view, int position) {         toast.maketext(navigation.this, "position " + position, toast.length_short).show();            } })); 

what want achieve when user clicks on article redirected new fragment or activity can view recycler in full..regards

try start new activity using intent , pass position parameter intent in detail activity fetch result based on position

recyclerview.addonitemtouchlistener(new recycleritemclicklistener(this, recyclerview, new recycleritemclicklistener.onitemclicklistener() {                @override             public void onitemclick(view view, int position) {                                intent = new intent(signupactivity.this,loginactivity.class);              i.putextra("email",list.get(position).getemail());              i.putextra("address",list.get(position).getaddress());              i.putextra("image",list.get(position).getimageurl());              startactivity(i);              }              @override             public void onitemlongclick(view view, int position) {                 toast.maketext(navigation.this, "position " + position, toast.length_short).show();            }         })); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -