title: Android insert image into DB
body: <p>I'm new to Android development and I'm trying to insert an image into a database but its not working. Below is some of my code:</p>
  
  <p>On click Code  </p>
  
  <pre><code>public void click(View v){
          img= DatabaseHandler.getBytes(BitmapFactory.decodeResource(getResources(), R.drawable.test));
  
           DatabaseHandler.insertFood("test","test",10.00,img);
           Toast toast =  Toast.makeText(getApplicationContext(), "TEST", Toast.LENGTH_LONG);
          toast.show();
  
      }
  </code></pre>
  
  <p>DatabaseHandler Class  </p>
  
  <pre><code>   public static long insertFood( String Name, String Description, Double Price,Byte[] Image ){
          ContentValues cv = new ContentValues();
          cv.put(nam,Name);
          cv.put(descrp, Description);
          cv.put(prc, Price);
          cv.put(img, Image);
          return sdb.insert(TABLE, null, cv);
      }
      public static byte[] getBytes(Bitmap bitmap) {
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            bitmap.compress(CompressFormat.PNG, 0, stream);
            return stream.toByteArray();
           }  
  </code></pre>
  
  <p>The error<br>
  <img src="https://i.stack.imgur.com/GEmvZ.png" alt="enter image description here"></p>
  
  <p>Image 2
    <img src="https://i.stack.imgur.com/ZxAxM.png" alt="enter image description here"></p>