Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is my question. When making a game app for Android, I considered first the device. It's no problem to save progress everything (from levels to records) on a smartphone because it has an SD Card slot. Exception to this, the tablet PC, it can really nothing but on internal only storage.

For example, I'm using this tutorial for audio spectrum (see that involves copying from internal to external in order to detect frequency. It works on the desktop but not on the Android device (Tablets only [i.e. Google Nexus Tablet]).

Is there a way to optimize save/load game problems due to internal/external device issues? Plus, additionally, what's the reason why my device won't work on tablets, except the desktop, while testing the audio spectrum code and why? Also, is it the same with saving/loading game?

share|improve this question
up vote 1 down vote accepted

I finally understand about Preferences. Here's the example and observe the comments. Take note that this is sample from my previous projects.

public class Temporary_Database 
    //TODO __________[ Field data ]__________
    public Preferences pref_1;
    public Preferences pref_2;
    public String male_name;
    public String female_name;

    //TODO __________[ Temporary Database's Constructor ]__________
    public Temporary_Database()
        pref_1 ="male-identity"); // You can use any String ID written within the parameter.
        pref_2 ="female-identity");

    //TODO __________[ Loading Methods ]__________
    public void Load_Name_of_Male(String male_name)
        male_name = pref_1.getString("Male's Name", male_name); // "male_name", for example, is the String object and this is where you recall the value itself through loading it.
        this.male_name = male_name;

    public void Load_Name_of_Female(String female_name)
        female_name = pref_2.getString("Male's Name", female_name);
        this.female_name = female_name;

//TODO __________[ Saving Methods ]__________
public void Save_Name_of_Male(String male_name)
    pref_1.putString("Male's Name", male_name); // "male_name" is the String object and this is where you change the value itself through loading it.
    pref_1.flush(); // Flush to save changes.

public void Save_Name_of_Female(String female_name)
    pref_2.putString("Male's Name", female_name);

    //TODO __________[ Set Value Method ]__________
    public String Get_Male_Name()
        return male_name; // Uses as the new value itself after saving it and preferred to be used in loading action.

    public String Get_Female_Name()
        return female_name;


share|improve this answer
Hope you cant count on your knowledge, David. Remember, instead of asking questions, why don't you discover it? Observe and find out. You'll only ask questions only if you find something not familiar to. Anyways, how does this using preferences work? Can it be also used for storing as database especially in MMORPG games where you stored items in the inventory? Just a question that I would like to know. – Tredecies Nocturne Feb 7 '13 at 11:50
It could be @TredeciesNocturne but it needs a lot of array for that specific item or rows. I haven't experienced using database using only 'Preferences' and arrays. Unless, I can made a good method for this. – David Dimalanta Feb 7 '13 at 12:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.