title: Android convert a bitmap to URL
body: <p>I am trying to get the url of a bitmap image. I've trued converting it to a uri using:</p>
  
  <pre><code>private Uri getImageUri(Context context, Bitmap inImage) {
      ByteArrayOutputStream bytes = new ByteArrayOutputStream();
      inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
      String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), inImage, "Title", null);
      return Uri.parse(path);
  } 
  </code></pre>
  
  <p>and</p>
  
  <p>getImageUri(this, image);</p>
  
  <p>But I get an error saying:</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Failure delivering result
    ResultInfo{who=null, request=1, result=-1, data=Intent {
    act=inline-data flg=0x1 (has extras) }} to activity
    {com.example.qrscannertest/com.example.qrscannertest.MainActivity}:
    java.lang.NullPointerException: uriString</p>
  </blockquote>
  
  <p>I don't understand what is wrong.</p>