I want to create a spinner widget, and I added this to string.xml
:
<string-array name="options">
<item>All Tasks</item>
<item>Today's Tasks</item>
<item>Tomorrow's Tasks</item>
<item>Archived Tasks</item>
</string-array>
and I adapted it:
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.options, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
and I got a build error:
Cause: startElement.getAttributeByName(QName("name")) must not be null
How can I solve this?
Special character like apostrophe(') are not allowed in xml directly Use can use escape sequences to get the desired result.
Replace: Today's by Today \ 's
Use a \ backslash symbol before apostrophe '
In String.xml
replace 'String which you have entered' to String which you have entered
or simply remove ' ' these
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With