Sid Go
Sid Go

Reputation: 2151

How to add a very large amount of data in my Android app?

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.

Upvotes: 0

Views: 1424

Answers (1)

Pratik Butani
Pratik Butani

Reputation: 62421

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.

Upvotes: 3

Related Questions