简体   繁体   中英

“call to OpenGL ES API with no current context” while using imageloader in android

i am getting message:

call to OpenGL ES API with no current context (logged once per thread)

and my app runs fine but nothing appears in view pager .I have used imageloader to download images and display them in it.

i think i have used imageloader incorrectly

my pageradapter class:

 public class pageradapter extends PagerAdapter {


    Context mContext;
    LayoutInflater mLayoutInflater;
    List<String> l = MainActivity.list;
    ImageLoader mImageLoader;

    public pageradapter(Context context) {
        mContext = context;



    }

    @Override
    public int getCount() {
        return 4;
    }


    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        //  View itemView = mLayoutInflater.inflate(R.layout.img, container, false);
          ImageLoader mImageLoader = ImageLoader.getInstance();

mLayoutInflater=((LayoutInflater) container.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE));
        View view = mLayoutInflater.inflate(R.layout.img, container, false);
        final ImageView imageView = (ImageView) view.findViewById(R.id.imageView3);



        mImageLoader.displayImage(l.get(position),imageView);


        container.addView(view);

        return view;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((LinearLayout) object);
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }
}

I had the same warning message and searched a lot over internet but found no solution. Somewhere I read about setting viewpager's fragment's imageview layout_width and layout_height to match_parent and it works. Don't know how. I used FragmentPagerAdapter and was downloading and displaying images over internet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM