During the scrulling viewpager on Android monitor, Skipped 39 frames come out!



  • During the scrubling viewpager on Android monitor, Skipped 39 frames are released! The application may be doing too much work on its main thread and the annexes are braked.

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if(pos == null && getArguments() != null) {
            id_fasl = getArguments().getString("id_fasl");
            id_table = getArguments().getString("id_table");
        }else{
            pos = 0;
        }
        View rootView = inflater.inflate(R.layout.fragment_screen_one, container,false);
    
    return rootView;
    

    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
    mViewPager = (ViewPager) view.findViewById(R.id.viewpager);
    Tasker tasker = new Tasker();
    tasker.execute();

    mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
    mSlidingTabLayout.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() {
        @Override
        public int getIndicatorColor(int position) {
            return getResources().getColor(R.color.colorPrimary);
        }
        @Override
        public int getDividerColor(int position) {
            return getResources().getColor(R.color.colorPrimaryDark);
        }
    });
    mSlidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }
        @Override
        public void onPageSelected(int position) {
            ((ModdaActivity)getActivity()).getSupportActionBar().setTitle(bob_name[mViewPager.getCurrentItem()]);
        }
        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    

    }

    class SamplePagerAdapter extends PagerAdapter {
    @Override
    public int getCount() {
    return kol;
    }
    @Override
    public boolean isViewFromObject(View view, Object o) {
    return o == view;
    }
    @Override
    public CharSequence getPageTitle(int position) {
    return "БОБИ " + (id_bob[position]);
    }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
    View view = getActivity().getLayoutInflater().inflate(R.layout.pager_item,
    container, false);
    container.addView(view);
    txt = (TextView) view.findViewById(R.id.item_text);
    txt.setText(moddas[position]);
    ((ModdaActivity)getActivity()).getSupportActionBar().setTitle(bob_name[mViewPager.getCurrentItem()]);
    return view;
    }
    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView((View) object);
    }
    }



  • It's a normal reaction to heavy operations. UI- the flow. I guess you're having a hard time. View/Love dive.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2