0

OVERVIEW:

I have a database that contains more than 128,000 records, and each record contains about 12 columns (8 string columns with lengths of about 1-2 words each column, and 4 columns containing reference or indices of 4 images respectively).

GOAL:

What I want basically is that when the user chooses a chapter contained in a spinner, the app shall retrieve the data relevant to the chapter chosen and display it on the screen (this is oversimplification though).

WHAT I DID but FAILED:

  1. Creating a class for each column. (This taught me, in the hard way, the 64KB limit thing in Java.)
  2. Creating an XML resource file for each column. (Failed because apparently, there's a limited number of ID, in effect resources, in an app)

WHAT I'M PLANNING TO (LEARN AND) DO:

  1. Create an SQLite Database. (But I worry how would I prepopulate it with my data? Wouldn't this lead to the 64KB limit error?)

  2. Create a text file for each column and store them as raw resources then retrieve them using input stream. (I, TBH, don't know what I'm talking about here. I picked this up while reading some sites yesterday).

So, what should I do?

(MORE DETAILS):

  1. My app has a spinner containing 114 chapter titles
  2. When the user chooses a chapter, the verses of the chapter will be displayed in the screen.
  3. Each token (or say, word) of each verse is clickable.
  4. Each token (including its details) represents one record in the database.
  5. When the user clicks the token, the details about it will be displayed.
  6. The details consist of 8 string columns, and 4 columns containing reference to the 4 images (image of a page of a dictionary).
  7. The total aggregate size of the images is about 90 MB.
Community
  • 1
  • 1
Sid Go
  • 2,041
  • 3
  • 16
  • 29
  • "when the user chooses a chapter contained in a spinner, the app shall retrieve the data relevant to the chapter chosen" -- nothing else in this question has anything to do with a "chapter", nor do you explain what a "chapter" is relative to "records" or "columns". – CommonsWare Dec 17 '15 at 11:45
  • 1
    You mention 4 image columns per record. How large is an image? Unless they are very small you will need several GB of storage on the device to store the whole DB locally. – Henry Dec 17 '15 at 11:50
  • I edited my post to answer your questions. Thank you. – Sid Go Dec 17 '15 at 11:58
  • You may have to follow this answer. http://stackoverflow.com/a/18074302/1318946 – Pratik Butani Dec 17 '15 at 12:00
  • 128,000 records x 4 images x 50KB per image = ~24GB. You cannot create an Android app that large. So, at minimum, the image data cannot be in the app itself. 128,000 records x 8 strings x 1.5 words per string x 5 characters per word (rough estimate) = ~8 million characters. That could fit in an app. So, you first need to decide whether you want to handle all the data the same (in which case, you are limited by your images), or if you want to package the text with the app and handle the images separately. – CommonsWare Dec 17 '15 at 12:02
  • No. Actually, most records share the same images. It's misleading how I said "contains 4 images". They actually contain 4 columns with the indices of the relevant image. In total, the images has a disk size of about 90 MB. Sorry for the misleading info. I'll edit that now. Thank you. – Sid Go Dec 17 '15 at 12:07
  • If you have this much large DB, Better to prefer maintain DB at server side and get it by the web services. It is better in feature you have any modifications in data and u may want to increase entries it is easy to you for maintenance. – Ravi Jaggarapu Dec 17 '15 at 12:15
  • @SidGo : what is the 64KB error you are referring to ? – j10 Jun 03 '17 at 15:11

1 Answers1

3

First of all you have to create Datebase from Server Side and you have to manage same Database from Android Side like SQLite.

When your application load first time, you have to copy all the data from server in chunks.(Manage OutOfMemoryError)

then you can use all the data from SQLite so it will work speedy.

After all you have to sync do sync process as i have mentioned here.

Thanks you.

Community
  • 1
  • 1
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437