Using some kind of "external ID" for a View
<p>i wrote a View class based on ViewSwitcher and now I want to write helper classes for the view like known form the ListView: ListAdapter, ListActivity and so on..</p>

<p>Regarding the activity class I ran into a problem. The ListActivity forces you to add a ListView to your activity with a fixed id: @id/android:list. In my base activity class i want to archive the same, forcing a special id so that my helper classes can access the view object.</p>

<p>As I'm writing a general lib that could be used in various projects I can't use R.id.foobar to get the view as there's no R class. The specific project will an own R.java.</p>

<p>So I peeked at the source code of ListActivity and found:</p>

<pre><code>View emptyView = findViewById(com.android.internal.R.id.empty);
mList = (ListView)findViewById(com.android.internal.R.id.list);
if (mList == null) {
    throw new RuntimeException(
        "Your content must have a ListView whose id attribute is " +
        "'android.R.id.list'");
}
</code></pre>

<p>Ok, I could write my on R class, put it directly into my package and try to access it in the same way but I've no clue what value the id should have or need?</p>

<p>Also I couldn't find any R class at android_frameworks_base/core/java/com/android/internal</p>

<p>And even if this problem is solved: How can the user of my lib access "my id" from his layout XML?</p>

<p>Thanks for your help! :)</p>
