title: Encode and decode bitmap object in base64 string in Android
body: <p>I want to encode and decode <code>Bitmap</code> object in string <code>base64</code>. I use the Android API10,</p>
  
  <p>I have tried, with no success, to use a method in this form to encode a <code>Bitmap</code>.</p>
  
  <pre><code>public static String encodeTobase64(Bitmap image) {
      Bitmap immagex=image;
      ByteArrayOutputStream baos = new ByteArrayOutputStream();  
      immagex.compress(Bitmap.CompressFormat.JPEG, 100, baos);
      byte[] b = baos.toByteArray();
      String imageEncoded = Base64.encodeToString(b,Base64.DEFAULT);
  
      Log.e("LOOK", imageEncoded);
      return imageEncoded;
  }
  </code></pre>