On Jul 8, 11:44 am, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> The id you pass to the constructor of the ArrayAdapter is the id of
> the XML layout to inflate. This means you have to use something like
> R.layout.my_layout. If you do not want to use XML (and you should
> because it's more flexible as it can adapt to various configurations,
> languages, etc.) you will have to create your own adapter and override
> the getView() method. With some adapters, like SimpleCursorAdapter,
> you can also supply a ViewBinder.


I used XML and it works fine now, but I have another problem:

each item on my list has a button, I need to detect when they are
clicked and which one is clicked. I tried this:

...
...
...
dButton= (Button)this.findViewById(R.id.dButton);
        dButton.setOnClickListener(onClickListener);

    }

private Button.OnClickListener onClickListener= new
Button.OnClickListener(){

        public void onClick(View v){
                Log.v("onClickListener", "button clicked");
        }

};


I am sure that the listener part is throwing up a null pointer
exception. What should I do? thanks.

Sylvester
--~--~---------~--~----~------------~-------~--~----~
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