Not using @+id through

ArrayAdapter<String> MyList = new ArrayAdapter<String>(this,
R.layout.mylist);

works fine, but using @+id through

ArrayAdapter<String> MyList = new ArrayAdapter<String>(this,
R.id.mylist);

does not, where my mylist.xml reads

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:gravity="center_vertical"
    android:paddingLeft="6dip"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:id="@+id/mylist"
/>

It all compiles just fine, but at runtime I get

ERROR/AndroidRuntime(1356): android.content.res.Resources
$NotFoundException: Resource ID #0x7f06001a type #0x12 is not valid

Am I missing some conceptual issue with the use of ArrayAdapter or the
way @+id gets expanded? Of course I can just use R.layout.mylist, but
it feels a bit inconsistent as I use the R.id referencing in my source
code with many other items (albeit through findViewById()).

Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to