samedi 12 mars 2016

Storing all Sqlite rows into variables/objects! Is this a good practice? [Android, Sqlite]

I am developing a audio player, and retrieve all rows of songs from android mediastore database.

The point is the number of rows could be like from hundreds to thousands, i had 20K songs on one device.

I want to ask can i retrieve all rows from the database and save them into class objects? Is this a good practice? will it consume more memory or create crashes?

For example i create a class which retrieves all values from a row.

class TableRow{...}// for retrieving one row

and a ArrayList

ArrayList<TableRow> rows=new ArrayList<TableRow>();//for storing all rows

is this practice ok or is it bad? i am planning to retrieve all rows on application start and keep them stored in ArrayList until application destroys.

Please suggest Thanks for your time friends

Aucun commentaire:

Enregistrer un commentaire