Inside for loop i am receiving the values of an array element, in the same loop how can i convert the string array into string so that I can save values in android preference. Below is my code :
Class A {
private String[] array = new String[20];
for (int i = 0; i <= count; i++) {
Log.d(TAG, "array == " + array[i]); //Here in below log I will receive all the array values
for (int j = 0; j <= count; j++) {
String a=array[j];
editor.putString("myString"+String.valueOf(j), a);
editor.commit();
Log.d("Prefs", "Saved String");
}
int size= sharedPreferencesFDefault.getInt("arraySize", 0);
String[] arrayGet = new String[size];
for (int k = 0; k < size; k++) {
arrayGet[k] = sharedPreferencesFDefault.getString("myString"+String.valueOf(k), "");
Log.d("Prefs", "Received String" + arrayGet[k]);
}
}
}
Thanks