title: How to set Notification icon from Imageview
body: <p>Hi guys i am trying to implement notifications into my application. The thing is that i want each notification to have a certain image taken from the imageview if possible.</p>
  
  <p>Since the <a href="http://developer.android.com/reference/android/app/Notification.Builder.html" rel="nofollow">documentation</a> says that the <code>setSmallIcon()</code> method can only take an <code>int resId</code> as parameter i have to use the <code>setLargeIcon()</code> method.  How can i convert an Image that comes from URL into Bitmap?</p>
  
  <p><strong>Already Tried:</strong></p>
  
  <pre><code>Bitmap bmp = BitmapFactory.decodeFile(getIntent().getStringExtra("stockImage"));
  builder.setLargeIcon(bmp); 
  </code></pre>
  
  <p>It gives me this <strong>error</strong>:</p>
  
  <pre><code>02-15 11:34:34.576    1615-1615/com.kostas.stockpredictions E/BitmapFactory﹕ Unable to decode stream: java.io.FileNotFoundException: http:/www.chatapp.info/myProject/images/ALPHA.png: open failed: ENOENT (No such file or directory)
  </code></pre>
  
  <p>I set this url into an Imageview using Ion library like this:</p>
  
  <pre><code>iv = (ImageView)findViewById(R.id.currentStockImageViewItem);
  Ion.with(iv).placeholder(R.drawable.ic_chat).error(R.drawable.ic_chat).load(i.getStringExtra("stockImage"));
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>class GetBitmapUrl extends AsyncTask&lt;String, Void, Bitmap&gt;{
  
          @Override
          protected Bitmap doInBackground(String... params) {
              try {
                  URL url = new URL(params[0]);
                  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                  connection.setDoInput(true);
                  connection.connect();
                  InputStream input = connection.getInputStream();
                  Bitmap myBitmap = BitmapFactory.decodeStream(input);
                  return myBitmap;
              } catch (IOException e) {
                  e.printStackTrace();
                  return null;
              }
          }
  
  
  
          @Override
          protected void onPostExecute(Bitmap result) {
              builder.setLargeIcon(result);
          }
      }
  
      public void getBitmap(){
          GetBitmapUrl task = new GetBitmapUrl();
          task.execute(getIntent().getStringExtra("stockImage"));
      }
  </code></pre>
  
  <p>And i call this method here:</p>
  
  <pre><code>Button notify = (Button)findViewById(R.id.buttonNotify);
                      notify.setOnClickListener(new View.OnClickListener() {
                          @Override
                          public void onClick(View v) {
                              builder = new NotificationCompat.Builder(StockItem.this);
                              builder.setContentTitle(name);
                              builder.setContentText(getString(R.string.notifyText) + " " + new DecimalFormat("###.##").format(avg));
                              builder.setWhen(System.currentTimeMillis());
                              getBitmap();
                              //builder.setSmallIcon(R.drawable.ic_launcher_stock_custom_icon);
                              builder.setTicker(getString(R.string.notifyTicker));
                              builder.setSound(Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE
                                      + "://" + getPackageName() + "/raw/carme"));
                              builder.setDefaults(NotificationCompat.DEFAULT_LIGHTS | NotificationCompat.DEFAULT_VIBRATE);
                              builder.setAutoCancel(true);
                              Intent intent = new Intent(StockItem.this, ListLoaderActivity.class);
                              TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(StockItem.this);
  
                              taskStackBuilder.addNextIntent(intent);
                              taskStackBuilder.addParentStack(ListLoaderActivity.class);
  
                              PendingIntent pendingIntent = taskStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
                              builder.setContentIntent(pendingIntent);
                              NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
                              manager.notify(1, builder.build());
  
                          }
                      });
  </code></pre>
  
  <p>Now the notification does not show up..</p>
  
  <p>Is it possible to have a Bitmap with the image from imageview?</p>
  
  <p>Thanks in advance!!!</p>