0

I´m trying to process an image from a BroadcastReceiver on Android but my log display the following error: call to OpenGL ES API with no current context (logged once per thread). Any ideas. this is my code:

 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;
}
josiland
  • 163
  • 2
  • 11

1 Answers1

0

You shouldn't do anything in BroadcastReciever other than starting services and activities. BroadcastReceiver instantiated by system with a very limited context which, probably, lacks accelerated graphics support.

android.graphics package contains classes that tightly related to graphic hardware in platform, so Android Context object without actual openGL context can not be used to perform some manipulations specified in this package.

weaknespase
  • 1,014
  • 8
  • 15