Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to optimize the insertion of an entry with multiple Strings and Images into a SQLite database
    primarykey
    data
    text
    <p>I defined a method to add an entry in my database helper class and insert data into database using it, but it is not working. This is my method defined in databasehelper class:</p> <pre><code> public void createchannelEntry(ChannelPoster channel) { openDB(); ByteArrayOutputStream out = new ByteArrayOutputStream(); channel.getPoster().compress(Bitmap.CompressFormat.PNG, 100, out); ContentValues cv = new ContentValues(); cv.put(KEY_POSTER, out.toByteArray()); cv.put(KEY_CHANNEL, channel.getChannel()); cv.put(KEY_PATH, channel.getPath()); cv.put(KEY_DBLINK, channel.getDBlink()); mDb.insert(channelS_TABLE, null, cv); closeDB(); } </code></pre> <p>this is how I insert data</p> <pre><code>Bitmap sherlock = BitmapFactory.decodeResource(getResources(), R.drawable.sherlock); mDB.createchannelEntry(new ChannelPoster(sherlock, "aa" ,"ll" ,"ha" )); </code></pre> <p>and I have a JavaBean for holding an entry</p> <pre><code>public class ChannelPoster { private Bitmap poster; private String channel; private String path; private String dblink; public ChannelPoster(Bitmap pi, String c, String p, String d) { poster = pi; channel = c; path = p; dblink = d; } public Bitmap getPoster() { return poster; } public String getChannel() { return channel; } public String getPath() { return path; } public String getDBlink() { return dblink; } } </code></pre> <p>And because I am adding entries one by one, the program runs very slow, so it's there a faster way to insert many entries? like get all of them in one event?</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.
 

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