// ArrayList -> Json으로 변환
private static final String SETTINGS_PLAYER_JSON = "settings_item_json";
btnPutJson.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ArrayList list = new ArrayList();
list.add("first");
list.add("second");
list.add("third");
list.add("fourth");
setStringArrayPref(SETTINGS_PLAYER_JSON, list);
Log.d(TAG, "Put json");
}
});
// Json -> ArrayList로 변환
btnGetJson.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ArrayList list = getStringArrayPref(SETTINGS_PLAYER_JSON);
if (list != null) {
for (String value : list) {
Log.d(TAG, "Get json : " + value);
}
}
}
});