Hi,

Keep getting
   "Unable to start
activity...ComponentInfo{...}java.lang.NullPointerException"
error.

Tried couple of basic examples from web, same problem:

Actual Code:

public void onCreate(Bundle icicle)
{
        super.onCreate(icicle);

        setContentView(R.layout.enter_device_name);

        final Button button = (Button) findViewById(R.id.okButt);

        //
***********************************************************************************
        // If I remove the bottom statement, I can see the UI display; a
textedit and a abutton.
        // The line below causes the crash.
        //
***********************************************************************************
        button.setOnClickListener(
                new Button.OnClickListener()
                {
                        public void onClick(View v)
                        {
                        }
                }
        );
}

XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFEE9"   android:padding="10px">

    <TextView id="@+id/nameLab"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="Type your name"/>

    <EditText id="@+id/yourName"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_below="@id/nameLab"/>

    <Button id="@+id/okButt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginLeft="10px"
            android:text="OK"
            android:layout_below="@id/yourName"/>

</RelativeLayout>

SDK: m5. Emulator using HVGA-P.

Also tried to use a dialog box. Also crashes when I call
setOnClickListener.

BTW, the 'okButt' button always display on top of the 'yourName' edit
box, isn't it suppose to be
'layout_below'? Other XML that I copied from some example exibit the
same behavior. Any clue?

Cheers...

Jason Tai
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to