java OutOfMemoryError when reading in a database file

paca

New Member
Licensed User
Longtime User
Hi,

I am brand new to Basic4Android and android.
I am trying to read in a fairly large database file (a table of 27 columns and 2000 rows).
I tried with the (slightly modified) "SqlDemo" program from the tutorial and also with the SQLiteDB program from Klaus CHRSITL.
Both however terminate with a java.lang.OutOfMemoryError somewhere between reading the 1000th and 2000th row.
I know it is a whole lot of data, but it is only text, so expressed in bytes, with todays memory chips this should be barely worth mentioning. So I guess it must be the graphical representation (Scrollview?) eating that memory.
If I look at the RAM usage on my android tablet I indeed see a whole bunch of used memory, but nevertheless there also remains a lot of memory unused.

So my question:
- Is there a way I could increase the amount of memory an application gets?
- Is there perhaps a more memory efficient way of showing a (scrollable) table of text?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Is there a way I could increase the amount of memory an application gets?
No (there is a way to ask for more memory on Android 3.0 or above. However you should find a different solution).

Is there perhaps a more memory efficient way of showing a (scrollable) table of text?
Can you upload your project with the database?
 
Upvote 0

paca

New Member
Licensed User
Longtime User
Hoi Erel,

Thanks for your reply. Please find the project in the zip attachment. It is essentially just your SqlDemo as you will see. The database is just a dummy for now, but the columns are correct and the number of rows are also according to the target. It all still needs to be tweaked and tuned and updated, but then first i must be certain it is do-able! I only want to develop for my 10.1" tablet, so I do not have to be concerned about different sizes (or memory issues, I thought)
 

Attachments

  • MyPlantenDb.zip
    41.3 KB · Views: 234
Upvote 0

paca

New Member
Licensed User
Longtime User
Hmm... no doubt the user will need, and often use, a good filter, sort or search button, but nevertheless the possibility for scrolling through everything is required when he "just cannot recall that name" for the moment.

Perhaps I should take a closer look to this DBUtils.ExecuteHtmlTable, but i was trying to avoid this, as it seems more difficult for me to let it co-operate with the rest of the Basic4Android program.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…