Tuesday, 27 August 2013

android how can i format a arrayList

android how can i format a arrayList

i have a problem with format arrayList.I have one parameter it have value
Licence_car:[[¤Â1453 ¡Ãا෾ÁËÒ¹¤Ã], [ç2344 ¡Ãا෾ÁËÒ¹¤Ã], [ù4679
¡Ãا෾ÁËÒ¹¤Ã]] (Data is a ThaiLanguage)
I use this parameter to set entry of list preference but it will show like
this
I want to delete character is "[" and "]" to make a variable like this
Licence_car:[¤Â1453 ¡Ãا෾ÁËÒ¹¤Ã, ç2344 ¡Ãا෾ÁËÒ¹¤Ã, ù4679
¡Ãا෾ÁËÒ¹¤Ã] how can i do that?
This is my code set entry to list preference.
@SuppressWarnings("unchecked")
public void showCar(Context context,ArrayList<String> currentCars){
SharedPreferences MYprefs = context.getSharedPreferences(PREFERENCES,
PREFERENCE_MODE);
if (null == currentCars) {
currentCars = new ArrayList<String>();
}
try {
currentCars = (ArrayList<String>)
ObjectSerializer.deserialize(MYprefs.getString("car_licence_",
ObjectSerializer.serialize(new ArrayList<String>())));
//String[] car_list = currentCars.toCharArray;
Log.d(TAG,"Licence_car:"+currentCars);
final CharSequence[] charSequenceCarEntry =
currentCars.toArray(new CharSequence[currentCars.size()]);
mCarDefault.setEntries(charSequenceCarEntry);
mCarDefault.setEntryValues(charSequenceCarEntry);
mCarDelete.setEntries(charSequenceCarEntry);
mCarDelete.setEntryValues(charSequenceCarEntry);
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
I get a preference value in arrayList and format to CharSequence[] for set
entry to list preference i think that i do format from this point but i
don't know how can do it.
Thank for any answer and sorry for my English.

No comments:

Post a Comment