0

i am developing a game in android .i want to store and retrieve the highest score . The number of records in higher score will be 10. So please tell me the best option(SQLlite , shared preferences etc) for store it .

4

1 回答 1

2

Use SharedPreferences because you have a fixed size (10) and it is simple to set up.

SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
editor.putInt(SCORE_1, 500);
editor.putInt(SCORE_2, 200);
editor.putInt(SCORE_3, 100);
editor.putInt(SCORE_4, 0);
...
editor.commit();

If you have dynamic data with different tables and a lot more data use a sqlite database.

See Android Storage Options for further details.

于 2013-07-17T10:14:02.103 回答