I don't know how you have created your Adapter for supplying to your
ListView subclass. I am assuming that you implemented an Adapter
subclass
that overrode getView() and is returning your row objects on demand,
perhaps instantiated via ViewInflate.
arrayAdapter1= new ArrayAdapter String(this,
Sylvester Steele wrote:
arrayAdapter1= new ArrayAdapter String(this, R.layout.component,
R.id.name);
is how I initialize my adapter. I do not override any methods.
component is my custom component and name is a textView that takes
the value.
That may make things more complicated for
Mark, a couple of questions:
1. I looked at the getView funtcion:ViewgetView(int position,
View convertView, ViewGroup parent).
I can understand that position refers to the particular element on
the list and ViewGroup parent to the custom view I am using for the
list items. But what
1. I looked at the getView funtcion: ViewgetView(int position,
View convertView, ViewGroup parent).
I can understand that position refers to the particular element on
the list and ViewGroup parent to the custom view I am using for the
list items. But what does View
It is unclear who this is in this.findViewById(R.id.dButton).
referred to the activity in the above post.
But changed it now to:
deleteButton1=
(Button)customComponent.findViewById(R.id.deleteButton);
customComponent is initialized as:
customComponent= new ConversationListView(this);
It is unclear who this is in this.findViewById(R.id.dButton).
referred to the activity in the above post.
But changed it now to:
deleteButton1=
(Button)customComponent.findViewById(R.id.deleteButton);
customComponent is initialized as:
customComponent= new ConversationListView(this);
dButton= (Button)this.findViewById(R.id.dButton); is I think where it
problem is. I played around a bit with it and realized that other
functions were also throwing up an exception. Then I just created a
new button, using new Button(this); and it worked fine.
So, why is dButton=
Sylvester Steele wrote:
dButton= (Button)this.findViewById(R.id.dButton); is I think where it
problem is. I played around a bit with it and realized that other
functions were also throwing up an exception. Then I just created a
new button, using new Button(this); and it worked fine.
So,
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
9 matches
Mail list logo