title: Get BLOB image from mysql database via JSON
body: <p>I have an image stored as BLOB in my MySQL database. I am returning the image back to the android app via PHP JSON array like this: <code>$row_array['image'] = base64_encode($row['image']);</code>
  Now I am getting the value in android like this <code>String image = c.getString(TAG_IMAGE);</code> where c is a JSON Object. Then I tried decoding it </p>
  
  <pre><code>byte[] b = Base64.decode(image, 0);
  
  Bitmap bmp = BitmapFactory.decodeByteArray(b, 0, b.length);
  </code></pre>
  
  <p>But this just gives me a null pointer exception and crashes. What am I doing wrong here?</p>
  
  <p>Logcat: </p>
  
  <pre><code>05-16 15:40:47.469: E/AndroidRuntime(30925): FATAL EXCEPTION: main
  05-16 15:40:47.469: E/AndroidRuntime(30925): java.lang.NullPointerException
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at com.example.shareity.ListNew$JSONParse.onPostExecute(ListNew.java:254)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at com.example.shareity.ListNew$JSONParse.onPostExecute(ListNew.java:1)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at android.os.AsyncTask.finish(AsyncTask.java:631)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at android.os.AsyncTask.access$600(AsyncTask.java:177)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at android.os.Handler.dispatchMessage(Handler.java:99)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at android.os.Looper.loop(Looper.java:137)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at android.app.ActivityThread.main(ActivityThread.java:4745)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at java.lang.reflect.Method.invokeNative(Native Method)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at java.lang.reflect.Method.invoke(Method.java:511)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  05-16 15:40:47.469: E/AndroidRuntime(30925):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>