我試圖從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 –