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
Post a Comment