title: share picture via Intent (Facebook and co)
body: <p>I'm wasting a lot of time, trying to get sharing a simple jpeg image working via sharing Intent.</p>
  
  <p>The most important one as usual is Facebook, and as usual it doesn't work.</p>
  
  <pre><code>Intent shareIntent = new Intent(Intent.ACTION_SEND);
  Uri picUri = Uri.parse("http://someserver.com/somepic.jpg");
  shareIntent.setType("image/jpeg");
  shareIntent.putExtra(Intent.EXTRA_STREAM, picUri);
  shareIntent.putExtra(Intent.EXTRA_TEXT, someString);
  startActivity(Intent.createChooser(shareIntent, "some text..."));
  </code></pre>
  
  <p>The chooser opens nicely, Facebook also opens and makes me login, but then it tells me that updoad failed.
  I also tried Flicker and Mail, and they all fail.
  Then I tried to write the image to local file and send from there, also failed:</p>
  
  <pre><code>    Drawable dr = ImageLoader.getDrawable(url);
      Bitmap bmp = ((BitmapDrawable)dr).getBitmap();
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      bmp.compress(Bitmap.CompressFormat.JPEG, 80, stream);
      byte[] data = stream.toByteArray();
  
      FileOutputStream ostream;
      try {
          ostream = this.openFileOutput("pic.jpeg", Context.MODE_WORLD_READABLE);
          ostream.write(data);
      } catch (Exception e) {
          e.printStackTrace();
      }
  
      Uri picUri = Uri.fromFile(new File("pic.jpeg"));
      shareIntent.putExtra(Intent.EXTRA_STREAM, picUri);
  </code></pre>
  
  <p>I've no clue if I do that correctly, haven't done that before.</p>
  
  <p>My last try was to just send an HTML string with the image included as img tag. But Facebook seems not to handle type "text/html", so it's not an option.
  I'm sure it needs only few lines of code. But which ones?</p>
  
  <p><strong>edit</strong></p>
  
  <p>I forgot the line</p>
  
  <pre><code>shareIntent.putExtra(Intent.EXTRA_STREAM, picUri);
  </code></pre>
  
  <p>in first code snippet. It was there when I tried, didn't work either.
  No sleep for too long...</p>