How to store image in SQLite database

You have to use “blob” to store image. ex: to store a image in to db: public void insertImg(int id , Bitmap img ) { byte[] data = getBitmapAsByteArray(img); // this is a function insertStatement_logo.bindLong(1, id); insertStatement_logo.bindBlob(2, data); insertStatement_logo.executeInsert(); insertStatement_logo.clearBindings() ; } public static byte[] getBitmapAsByteArray(Bitmap bitmap) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0, … Read more

File Upload in WebView

This is a full solution for all android versions, I had a hard time with this too. public class MyWb extends Activity { /** Called when the activity is first created. */ WebView web; ProgressBar progressBar; private ValueCallback<Uri> mUploadMessage; private final static int FILECHOOSER_RESULTCODE=1; @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if(requestCode==FILECHOOSER_RESULTCODE) … Read more