title: Unable to retrieve and set image from sqlite to ImageView in android
body: <p>I am trying to save an <code>Image</code> inside the <code>Sqlite</code> database in Android.I want to set that image on an <code>ImageView</code> after inserting it.  I tried with the following code but the image does not set. Can anyone tell me the problem with the code.</p>
  
  <pre><code>   Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
          ByteArrayOutputStream stream = new ByteArrayOutputStream();
          bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
          byte[] byteArray = stream.toByteArray();
          Log.i("ic launcher byte array", ""+byteArray);
          db.insert_signature_table(String.valueOf(AssignedJobs.jobId), String.valueOf(AssignedJobs.teamId), byteArray);
          Log.i("get all signature data", ""+db.getAll_signature_table().get(0).get("sign"));
           byte[] bb = db.getAll_signature_table().get(0).get("sign").getBytes();
           Log.i("decodes", ""+bb);
           Bitmap bmp1 = BitmapFactory.decodeByteArray(bb, 0, bb.length);
           edt_signature.setImageBitmap(bmp1);
  </code></pre>
  
  <p><strong>dbHelper class</strong></p>
  
  <pre><code>  query_signature_table = "CREATE TABLE signature_table(JobId STRING,TeamId STRING,sign BLOB)";
  database.execSQL(query_signature_table);
  
  
  
  public void insert_signature_table(String jobId, String teamId, byte[] imageInByte) {
  SQLiteDatabase database = this.getWritableDatabase();
  ContentValues values = new ContentValues();
  
  values.put("JobId", jobId);
  values.put("TeamId", teamId);
  values.put("sign", imageInByte);
  
  Log.i("values assigned", "" + imageInByte);
  
  database.insert("signature_table", null, values);
  database.close();
  }
  
  
  public ArrayList&lt;HashMap&lt;String, String&gt;&gt; getAll_signature_table() {
  ArrayList&lt;HashMap&lt;String, String&gt;&gt; wordList;
  wordList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  String selectQuery = "SELECT  * FROM signature_table";
  SQLiteDatabase database = this.getWritableDatabase();
  Cursor cursor = database.rawQuery(selectQuery, null);
  if (cursor.moveToFirst()) {
      do {
          HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
          map.put("JobId", cursor.getString(0));
          map.put("RigId", cursor.getString(1));
  
            byte[] temp_image = cursor.getBlob(2);
  
            map.put("sign",""+temp_image);
  
          wordList.add(map);
      } while (cursor.moveToNext());
  }
  </code></pre>