Frage

If a SpannableString can be set as the arguments of a fragment how is it done?

        Bundle args = new Bundle();
        args.putString(PagesFragment.ARG_SECTION_NUMBER, Page[position]);
        fragment.setArguments(args);
        return fragment;

What needs to be changed in this sample code?

War es hilfreich?

Lösung

As SpannableString implements CharSequence you can use putCharSequence method.

    Bundle args = new Bundle();
    args.putCharSequence(PagesFragment.ARG_SECTION_NUMBER, Page[position]);
    fragment.setArguments(args);
    return fragment;

Regards.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top