google cloud messaging - android - GCM Notification Dynamic Large Icon not working -


i trying load dynamic large icon gcm push notification. returns null. here code. bitmapfactory.decode() returns null. checked code fetch icon image view , works fine in case, not in case.

notificationcompat.builder mbuilder =                     new notificationcompat.builder(this)                     .setsmallicon(r.drawable.ic_launcher)                     .setlargeicon(downloadbitmap(url))                     .setcontenttitle(context.getstring(r.string.app_name))                     .setcontenttext(message);   static public bitmap downloadbitmap(string url) {         final androidhttpclient client = androidhttpclient.newinstance("android");         final httpget getrequest = new httpget("http://files.softicons.com/download/system-icons/crystal-project-icons-by-everaldo-coelho/png/22x22/apps/skype.png");          bitmap bitmap = null;         try {             httpresponse response = client.execute(getrequest);             final int statuscode = response.getstatusline().getstatuscode();             if (statuscode != httpstatus.sc_ok) {                  log.w("imagedownloader", "error " + statuscode + " while retrieving bitmap " + url);                  return null;             }              final httpentity entity = response.getentity();             if (entity != null) {                 inputstream inputstream = null;                 try {                     inputstream = entity.getcontent();                      bitmap = bitmapfactory.decodestream(new flushedinputstream(inputstream));                     return bitmap;                 } {                     if (inputstream != null) {                         inputstream.close();                       }                     entity.consumecontent();                 }             }         } catch (exception e) {             // provide more explicit error message ioexception or illegalstateexception             getrequest.abort();             log.w("imagedownloader", "error while retrieving bitmap " + url + e.tostring());         } {             if (client != null) {                 client.close();             }         }          return bitmap;     }      static class flushedinputstream extends filterinputstream {         public flushedinputstream(inputstream inputstream) {             super(inputstream);         }          @override         public long skip(long n) throws ioexception {             long totalbytesskipped = 0l;             while (totalbytesskipped < n) {                 long bytesskipped = in.skip(n - totalbytesskipped);                 if (bytesskipped == 0l) {                       int num_byte = read();                       if (num_byte < 0) {                           break;  // reached eof                       } else {                           bytesskipped = 1; // read 1 byte                       }                }                 totalbytesskipped += bytesskipped;             }             return totalbytesskipped;         }     } 

i got working... issue android emulator. using emulator 2.2. sson switched newer version started work


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -