Android Task Manager – SQLite

Meow meow~ It’s finally here~~ I’m finally able to save and load the list =A=” ((exhausted..

At first, I thought that using databases (e.g. MySQL or Hana) requires server setup (internet connection) that the users won’t be able to save their data locally. And so, I was using old rundown file io. However, the admin was so bored with the traditional File in = new File() etc, i went the crazy way with ObjectOuputStream  and ObjectInputStream because they could seemed to save me the pain from formatting the data (more about Object Serialization here).

Eventually, I was able to write and read the text file from the to-do list with Android’s openFileOutput() and openFileInput() commands. Regardless, only the last item of the data from the list can be saved or loaded because instead of appending, it’s overwritting the WHOLE damn thing (Guh!!). At first, I thought the problem lies with calling a new ObjectOutputStream instance every time the AddItem() method was triggered. Tried all the suggestion from StackOverflow and nothing worked.

Then I came across MODE and thought that might be the real issue. Changed PRIVATE to APPEND but, the command: FileOutputStream fos = openFileOutput(filename,Context.MODE_APPEND) doesn’t append shit. It kept catching the ioexception that it’s just wahhh~~ I’ve been dealing with this issue for the past four days. I had no choice but to raise the white flag.

And so, I was back checking out on DB materials again and am I glad that I did (only why didn’t I do it sooner D:). I googled some sample to-do android apps and found some great tutorials on connecting the database (what? cheater). The one I used was SQLite and the tutorial was here. I suppose that database is just similar to a library where I can just import it in as any other Java resources, so it does not require server (?). But, yeah, it’s working now. Tested on my android device and DB stuff works great!

The main view doesn’t extend to the whole screen even though the splash screen does. I was surprised that the landscape mode work since I didn’t implement anything. Sigh~ more things to look into then. Ta-ta now~

Screenshot_2014-07-12-02-07-24 Screenshot_2014-07-12-02-17-32

Testing on Acer Iconia A1-830