Search code examples
androidcharsequence

CharSequence[] to CharSequance


I am using the library material dialogs. The multi list uses CharSequence[] instead of CharSequence.

 @Override
 public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {

     // If Bold//
     if (text.equals("Bold") {

     }
}  

Because it is CharSequence[] and not CharSequence I can't get the text value. How do I get the text value out of CharSequence[]. Here is the link to the library if that helps :)

https://github.com/afollestad/material-dialogs


Solution

  • The call back your posted is for "Multi Choice List" which means there are multiple options that are returned in your call back in which array and text array.

    text is an array so you can get text of first choice like this:

    text[0]
    

    Same way you can check which:

    which[0]