Non-urgent Android layout id attribute quirk
<p>I'm working on a couple of apps at the moment while I try to learn my way around the Android SDK. I had a bit of trouble recently with my layouts where I was defining, for example, an EditText element as such...</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;

&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"&gt;

  &lt;EditText 
      android:id="@+id/price_per_pack"
      android:layout_width="100dip"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"/&gt;

  &lt;TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_toLeftOf="@id/price_per_pack"
      android:layout_alignParentLeft="true"
      android:textSize="12pt"
      android:text="Price Per Pack"/&gt;   

&lt;/LinearLayout&gt;
</code></pre>

<p>The application was compiling correctly, however when I attempted to start the activity which utilizes this layout nothing would happen. Through a process of elimination I identified the id attribute as the troublesome one and while playing about I discovered that changing  </p>

<pre><code>android:id="@+id/price_per_pack"
</code></pre>

<p>to </p>

<pre><code>android:id="@+android:id/price_per_pack"
</code></pre>

<p>solved my problem and the application behaved as expected. My initial attempt at declaring the id attribute was based upon examples in the SDK documentation so I'm wondering if somebody could explain to me why I needed to make the above change to get it working?</p>

<p>I'm sure that it won't make any difference but I'm developing using the android-mode.el emacs plugin and have a completely up-to-date copy of the SDK.</p>

<p>Thanks in advance.</p>
