mardi 7 février 2017

Memory leaks while using CircleImageView with FragmentPagerAdapter

Vote count: 0

I'm using FragmentPagerAdapter in my android project and everything works pretty fine. In the profile page I want to show circle image using CircleImageView library. ViewPager works fine while using normal image but when I'm using CircleImageView code then every time I slide pager it increase memory consumption. I tried it on a phone which have 3 gb of ram and within few slide it's getting out of memory. Someone please help me how to fix that. I want to use the library but not with memory issue. Here is my codes below.

adapterclass/
    private class ViewPagerAdapter extends FragmentPagerAdapter {
    private final List<Fragment> mFragmentList = new ArrayList<>();
    private final List<String> mFragmentTitleList = new ArrayList<>();

    public ViewPagerAdapter(FragmentManager manager) {
        super(manager);
    }

    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getCount() {
        return mFragmentList.size();
    }

    public void addFragment(Fragment fragment, String title) {
        mFragmentList.add(fragment);
        mFragmentTitleList.add(title);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mFragmentTitleList.get(position);
    }

}

xml code for image
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://ift.tt/GEGVYd"
android:id="@+id/profile_image"
android:layout_width="96dp"
android:layout_height="96dp"
android:src="@drawable/profile"
app:civ_border_width="2dp"
app:civ_border_color="#FF000000"/>

Don't know what is going everything works fine without the circle image view. Memory limit issue start while using circle image view.

Appriciate your help, Thanks, Robin

CircleImageView: http://ift.tt/L0H00t

asked 34 secs ago

Let's block ads! (Why?)



Memory leaks while using CircleImageView with FragmentPagerAdapter

Aucun commentaire:

Enregistrer un commentaire