Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>in the DBAdaper i.e Data Base helper class declare the table like this</p> <pre><code> private static final String USERDETAILS= "create table userdetails(usersno integer primary key autoincrement,userid text not null ,username text not null,password text not null,photo BLOB,visibility text not null);"; </code></pre> <p>insert the values like this,</p> <p>first convert the images as byte[]</p> <pre><code>ByteArrayOutputStream baos = new ByteArrayOutputStream(); Bitmap bitmap = ((BitmapDrawable)getResources().getDrawable(R.drawable.common)).getBitmap(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] photo = baos.toByteArray(); db.insertUserDetails(value1,value2, value3, photo,value2); </code></pre> <p>in DEAdaper class</p> <pre><code> public long insertUserDetails(String uname,String userid, String pass, byte[] photo,String visibility) { ContentValues initialValues = new ContentValues(); initialValues.put("username", uname); initialValues.put("userid",userid); initialValues.put("password", pass); initialValues.put("photo",photo); initialValues.put("visibility",visibility); return db.insert("userdetails", null, initialValues); } </code></pre> <p>retrieve the image as follows</p> <pre><code>Cursor cur=your query; while(cur.moveToNext()) { byte[] photo=cur.getBlob(index of blob cloumn); } </code></pre> <p>convert the byte[] into image</p> <pre><code>ByteArrayInputStream imageStream = new ByteArrayInputStream(photo); Bitmap theImage= BitmapFactory.decodeStream(imageStream); </code></pre> <p>I think this content may solve your problem</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload