I am new to android, so maybe this question is naive.
I am trying to build a layout with two lists side by side. It works fine when I have one list, but when I add a second one, I get this error.
My view extends Activity and not ListActivity.
But I just can't figure out why my build fails with this error:
\main.xml:13: error: Error: No resource found that matches the given name (at 'id' with value '@android:id/selected_list').
\Android\android-sdk\tools\ant\build.xml:598: The following error occurred while executing this line:
\Android\android-sdk\tools\ant\build.xml:627: null returned: 1
This is what my main.xml looks like:
<ListView  
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@android:id/list"
        android:layout_weight=".5"/>
    <ListView  
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@android:id/selected_list"
        android:layout_weight=".5"/>
                Use "@+id/list" and "@+id/selected_list" instead of the "@android:id/...".
To find these id's in the code use:
findViewById(R.id.list);
or
findViewById(R.id.selected_list);
and make sure you import the R file: .R; and not com.android.R;
change your id's of list view
code:
    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" >
    </ListView>
    <ListView
        android:id="@+id/selected_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" >
    </ListView>
                        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