how can I save a shared preference to an array, I tried a couple of things but I just can't do it, I want to save a specific key into the array and then put them in a textview and it just crash. please help guys.
public String[] fetchAllPreference(){
SharedPreferences sharedPref = getSharedPreferences("DictionaryInfo",
Context.MODE_PRIVATE);
//here i want the code of making it into array come
return values;
}
public void loadPicture()
{
gallery.removeAllViews();
String[] array =fetchAllPreference();
for(int i=0;i<array.length;i++)
{
TextView iv = new TextView(this);
LinearLayout.LayoutParams layoutParams=new
LinearLayout.LayoutParams(100,100);
layoutParams.setMargins(10,10,0,0);
iv.setLayoutParams(layoutParams);
iv.setText(array[i].toString());
gallery.addView(iv);
}
}