Showing posts with label Storage. Show all posts
Showing posts with label Storage. Show all posts

Thursday, March 13, 2014

Android - Type Safe SharedPreferences

OK, so how many time did you get so pissed because of the way you had to use the SharedPreferences and store stuff on Android?

I know this drove me mad more than once, and the fact I have to copy paste some implementation from one app to another was even more frustrating...

So.......  I've thought a while back to make a generic storage utility object, specifically for Android, (I already have something like that for Pure Java) and after a long while I have. I know this is a bit overkill, but hell, I would gladly pay with few extra lines of code to save hundreds, for a readable, comfortable and quick coding.

If you find the code useful, leave me a comment... I would like to know I'm not doing this for no good reason!

For me the code is pretty obvious, but then again I've been at it for years... let me know what is not clear so I can elaborate more about these subjects.



-- UPDATE --

I've released Cyborg not too long ago, and this sort of generic shared preferences is build in and optimized further in terms of how much code you need to write, You can find it here.