我试图从Android上的BroadcastReceiver处理图像,但我的日志显示以下错误:调用OpenGL ES API而没有当前上下文(每个线程记录一次)。有任何想法吗。这是我的代码:从Android上的BroadcastReceiver处理图像
public void processingImage(String image){
try {
if(image != null){
bmp = convertBitmap(image);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
bitmaps.add(bmp);
byteArray = stream.toByteArray();
}
} catch (Exception e) {
}
}
private Bitmap convertBitmap(String image) throws MalformedURLException, IOException{
Bitmap b = BitmapFactory.decodeStream((InputStream)new URL("http://mydomain.com/upload/" + image).getContent());
return b;
}
http://stackoverflow.com/questions/3383049/call-to-opengl-es-api-with-no-current-context –