Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing multiple string resources for different textviews
    primarykey
    data
    text
    <p>Hey, I'm currently having trouble with a small Android application I'm making. What I'm attempting to build is:</p> <ul> <li>A list interface with <ul> <li>Each row having two TextViews (a title and a caption).</li> <li>Have the values of these to be drawn from two separate string array resources.</li> </ul></li> </ul> <p>The interface has the following text views in <code>rowLayout.xml</code>,</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;TextView android:text="@+id/rowTitle" android:layout_height="wrap_content" android:id="@+id/title" android:textSize="25px" android:layout_width="match_parent"&gt; &lt;/TextView&gt; &lt;TextView android:text="@+id/rowCaption" android:layout_height="wrap_content" android:id="@+id/caption" android:textSize="25px" android:layout_width="match_parent"&gt; &lt;/TextView&gt; </code></pre> <p></p> <p>and the string resources are,</p> <pre><code>&lt;string-array name="menuEntryTitles"&gt; &lt;item&gt;Start&lt;/item&gt; &lt;item&gt;Stop&lt;/item&gt; &lt;/string-array&gt; &lt;string-array name="menuEntryCaptions"&gt; &lt;item&gt;Starts the update listener service.&lt;/item&gt; &lt;item&gt;Stops the update listener service.&lt;/item&gt; &lt;/string-array&gt; </code></pre> <p>There should be two rows titled Start and Stop and each has their relevant captions. I've attempted using an <code>ArrayAdapter</code> to implement this,</p> <pre><code>ArrayAdapter listAdapter = ArrayAdapter.createFromResource(this, new int[] {R.array.menuEntryTitles, R.array.menuEntryCaptions}, new int[] {R.id.rowTitle, R.id.rowCaption}); </code></pre> <p>but I'm getting errors due to <code>createFromResource</code> requiring <code>int</code> arguments when I can only provide <code>int[]</code>.</p> <p>Hope someone here can point me in the right direction.</p> <p>Cheers</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. This table or related slice is empty.
    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