I want to convert my ArrayList containing elements with the toString method shadowed in “T”:
public String toString(){
return name + " " + realname;
}
to a CharSequence array containing all the “T”s toString. Checked some stuff out but nothing works for me since CharSequence[] can’t be concatenated (correct me if i’m wrong).
Saw a solution for the ArrayList at -> ArrayList<String> to CharSequence[] which didn’t work out for me
I’m doing this because I’ve searched for devices (“T”) and added them to a Arraylist, the user then has to make a choice which one to accept by clicking on a mutliple choice dialogwindow as shown under DIALOG_TEXT_ENTRY in this link
Please help me out cause it’s driving me mad
So through the responses via the comments you guys suggested a solution with subsequence. However this is a similar solution I guess and it’s semi-implemented in my code already so I’m gonna go with this one with a few modifications ofcourse.
Feel free to still give feedback if it’s a bad way to implement or if there actually exists other ways of doing it!
::EDIT::
The solution was the following: I tried ot the code given by the link and take note that my ArrayList.toString() returns a String object with the following look for each element in the List
Taken to account that the toString() is overriden in the my object class. The following is done
And voila I have the String[] array and can now represent them as choices in my single choice list.