Bind array of strings in the butterknife
Asked Answered
S

1

9

I'm trying to bind array of strings using butterknife. But seems that there is no way (but in processor there is a method to bind array).

Here is my code:

strings.xml

<string-array name="test_strings">
    <item>VK</item>
    <item>Facebook</item>
    <item>Twitter</item>
    <item>Instagram</item>
    <item>Google plus</item>
    <item>Google mail</item>
</string-array>

MainActivity

@Bind(R.string.test_strings)
protected String [] mStrings;
Siple answered 9/7, 2015 at 12:16 Comment(2)
i never use it but ... github.com/JakeWharton/butterknife/blob/master/butterknife/src/… ... @BindArray ?Mangan
@Mangan i've found the answer, heh here in the class : github.com/JakeWharton/butterknife/blob/master/butterknife/src/… problem was I typed R.string.test_strings, when I should to type R.array.test_strings. Thanks!Siple
S
16

Five mins ago Butterknife 8.0.0 was released.

R.string.test_array change to R.array.test_array

And @Bind to @BindArray

Siple answered 9/7, 2015 at 12:35 Comment(4)
FYI @BindArray is not released as of the time of this writing (v7.0.1)Flews
@JakeWharton I noticed that, but seems, that it will work this way, right?Siple
Yep! Just waiting on a few things before releasing.Flews
@JakeWharton thanks for your work from all junior android devs. :)Siple

© 2022 - 2024 — McMap. All rights reserved.