Android attach Fragment to viewPager on Fragment dont work -


in 1 of activities have fragment that, in have 1 viewpager want use fragment that, attaching fragments don't work adapter.

code updated

@override public view oncreateview(layoutinflater inflater, viewgroup container,                          bundle savedinstancestate) {     view view = inflater.inflate(r.layout.fragment_food_list, container, false);     ...      foods_slider.setadapter(buildadapter());     return view; }  private pageradapter buildadapter() {     return(new foodslistslideradapter(getchildfragmentmanager())); } 

foodslistslideradapter class:

public class foodslistslideradapter extends fragmentpageradapter {     public foodslistslideradapter(fragmentmanager fm) {         super(fm);     }      @override     public fragment getitem(int fragmentid) {         switch (fragmentid) {             case 0:                 return foodlistpartone.newinstance(0);             case 1:                 return foodlistparttwo.newinstance(1);             case 2:                 return foodlistpartthree.newinstance(2);         }         return foodlistpartone.newinstance(0);     }      @override     public int getcount() {         return 3;     }      @override     public boolean isviewfromobject(view view, object object) {         if (object instanceof foodlistpartone) {             view.settag(0);         }         if (object instanceof foodlistparttwo) {             view.settag(1);         }         if (object instanceof foodlistpartthree) {             view.settag(2);         }         return super.isviewfromobject(view, object);     } } 

foodslistslideradapter must work on code , attach fragment viewpager


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -