Reputation: 57
I've prepared sqlite database in SQLite Manager with all data added manually. This db stored images (BLOB), text and video (BLOB) files. I cannot store only URL/SD card link to videos but whole file in database. I easily can get text and images from database and show in my application.
For images code below:
Cursor cursor = myDbHelper.getData(); // select from database text, images(BLOB) and videos(BLOB).
...
ByteArrayInputStream inputStream = new ByteArrayInputStream(cursor.getBlob(1)); //image
Bitmap b = BitmapFactory.decodeStream(inputStream);
ImageView iv = new ImageView(this);
iv.setImageBitmap(b);
And it is working. But I don't know how to get video from BLOB and display/play in VideoView field using:
ByteArrayInputStream inputStream = new ByteArrayInputStream(cursor.getBlob(2)); //video
How to put inputStream to VideoView or other format to display in application. Please help.
EDIT: I stored whole database (with text,images and videos) on device. I connect with external database (MySQL) only for update. And after updating records i.e. with movies, device doesn't use Internet connection any more.
Upvotes: 0
Views: 5010
Reputation: 76506
Here you go Tom, you just want to do streaming:
https://stackoverflow.com/a/2059259/413127
Upvotes: 3