android - change fragment by swiping or pushing button differences -
i have activity has 3 fragments. when i'm switching fragments swiping ok. on fragment 2 have button must set current fragment fragment 1. pushing button changes fragment problems expressed in pics when normal on . similar normal 1 . works correct on devices higher performance. how solve problem , problem connected?
button listener
onclicklistener btnlistener = new onclicklistener() { @override public void onclick(view v) { ((mainactivity)getactivity()).changefragment(2); } };
also here info mainactivity
mainactivity extends fragmentactivity implements clfragment.onfragmentinteractionlistener, fmfragment.onfragmentinteractionlistener
and
private class screenslidepageradapter extends fragmentstatepageradapter { public screenslidepageradapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int position) { if (position == 0) { return new clfragment(); } else if (position == 1) { return new vfragment(); } else { return fmfragment.newinstance(); } } @override public int getcount() { return page_count; } }
Comments
Post a Comment