簡體   English   中英

在Android中使用imageloader時“在沒有當前上下文的情況下調用OpenGL ES API”

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

我收到消息:

在沒有當前上下文的情況下調用OpenGL ES API(每個線程記錄一次)

而且我的應用程序運行正常,但視圖分頁器中沒有任何顯示。我已使用imageloader下載圖像並將其顯示在其中。

我想我沒有正確使用imageloader

我的pageradapter類別:

 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;
    }
}

我有同樣的警告消息,並在Internet上進行了大量搜索,但沒有找到解決方案。 我在某處讀到有關將viewpager片段的imageview layout_width和layout_height設置為match_parent的方法,並且可以正常工作。 不知道怎么做 我使用FragmentPagerAdapter並通過Internet下載和顯示圖像。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM