Hi,
I keep getting this error while trying to convert to CharSequence[].
The method toArray(CharSequence[]) is undefined for the type String
This is my code
CharSequence[] cs = abbrev.toArray(new CharSequence[abbrev.length()]);
And
Type mismatch: cannot convert from String to CharSequence[]
CharSequence[] abbrevCS = abbrev;
The abbrev is just splitting sentences into its first characters (Hello World --> HW)
String[] result = matches.toString().split("\\s+");
String abbrev = "";
for (int i = 0; i < result.length; i++){
char c = result[i].charAt(0);
if (c >= '0' && c <= '9'){
abbrev += result[i];
}
else{
abbrev += c;
}
}
I wish to put the abbrev into a alert dialog as follows
AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
builder2.setTitle("Make a choice from the list:");
builder2.setCancelable(false);
builder2.setItems(cs, new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int item) {
}
});
AlertDialog alert2 = builder2.create();
alert2.show();
Any ideas?