views:

12

answers:

0

Hello all.

I've an app already in the market that I'm proud of. It's called the hytech game of life. The core of the game is set up on an activity and a view, and the logic is run through the view.

I'm mostly happy with how it works but there's a few things that just are starting to get in the way of what I'm doing. I'm seeing slow down and some issues with data retention.

The main issues is there's ways that the view will get recreated (I've handled opening the slide and rotating the screen, but apparently if you start the preference with the slide open it still calls onSizeCreated (on a new view) and so on. So I want to attempt to take the hard data (the simulation) out of the view, or at least save it elsewhere. (And not hack it with a static instance of the array or something else)

The data is simple, a double array of integers (each of them only going to use a single byte tops, as there might be multiple colors in the future.). however the size of the array will be variable depending on screen size and grid cell size.

I've read up on http://developer.android.com/guide/topics/data/data-storage.html and my initial thoughts are to use the SQLDatabase, but I would like to know if other people have tried that with decent sized data (maybe I'll clear the table and save out only the active locations and the width and height of the grid)

The question I have is where should I store all this data efficiently, does SQLDatabase work well enough that I can call it on every key_down and still remain responsive enough to accept input?

Is it possible file IO can be faster? or would both of them be too slow for a simulation that has a frame every 100 ms or so.

In addition a future upgrade will be saving grids and placing them in the same size or larger grids. I assume I'm going to want to save it to the same area (or perhaps save that data to a file)

I know someone out there has already tackled this problem and would rather not reinvent the wheel if I don't have to.