Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>What you are attempting to do is not supported.</strong></p> <p>You likely have some code that looks like this:</p> <pre><code>ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.numbers, android.R.layout.simple_spinner_item); </code></pre> <p>Which is of course calling the following:</p> <pre><code>/** * Creates a new ArrayAdapter from external resources. The content of the array * is obtained through {@link android.content.res.Resources#getTextArray(int)}. * * @param context The application's environment. * @param textArrayResId The identifier of the array to use as the data source. * @param textViewResId The identifier of the layout used to create views. * * @return An ArrayAdapter&lt;CharSequence&gt;. */ public static ArrayAdapter&lt;CharSequence&gt; createFromResource(Context context, int textArrayResId, int textViewResId) { CharSequence[] strings = context.getResources().getTextArray(textArrayResId); return new ArrayAdapter&lt;CharSequence&gt;(context, textViewResId, strings); } </code></pre> <p>The call to <code>getTextArray</code> returns an array with null objects rather than the string representation of the values in your integer array. Digging deeper reveals the source of the problem is in a method of <code>AssetManager</code>:</p> <pre><code>/** * Retrieve the text array associated with a particular resource * identifier. * @param id Resource id of the string array */ /*package*/ final CharSequence[] getResourceTextArray(final int id) { int[] rawInfoArray = getArrayStringInfo(id); int rawInfoArrayLen = rawInfoArray.length; final int infoArrayLen = rawInfoArrayLen / 2; int block; int index; CharSequence[] retArray = new CharSequence[infoArrayLen]; for (int i = 0, j = 0; i &lt; rawInfoArrayLen; i = i + 2, j++) { block = rawInfoArray[i]; index = rawInfoArray[i + 1]; retArray[j] = index &gt;= 0 ? mStringBlocks[block].get(index) : null; } return retArray; } </code></pre> <p>This code assumes you have provided the resource id of an array of strings and thus it is unable to properly extract out values from your array of integers.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload