I'm brand new to developing for android, so this has been driving me
crazy all day even though I'm sure it's simple.

I'm going through the Hello Form Stuff tutorial and it seems like it
can't find a button resource in the drawable folder.  I've tried
placing the three icons and the XML file in the 'drawable' folder and
all three pixel density variants (ie: '-hdpi').  I've run 'Clean...'
on the project many times and it finds the correct R class, but it's
just not finding the button I've defined.

Here are the relevant parts (almost a straight copy/paste from the
tutorial)
/res/layout/main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
        <Button android:id="@+id/button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="10dp"
                android:background="@drawable/android_button" />
</LinearLayout>

/res/drawable/android_button.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android";>
        <item android:drawable="@drawable/android_pressed"
                android:state_pressed="true" />
        <item android:drawable="@drawable/android_focused"
                android:state_focused="true" />
        <item android:drawable="@drawable/android_normal" />
</selector>

HelloFormStuff.java:
        final Button button = (Button) findViewById(R.id.button);
        Log.v("HelloForms", button.getClass().toString());
        button.setOnClickListener(new OnClickListener() { ... }

--------
It was breaking on the line with button.setOnClickListener() so I put
the log command in there and now it breaks on that line instead (I
assume because you can't call getClass() on a null object).

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to