[英]“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.