[android-beginners] Re: Custom component using custom dialog

2009-09-09 Thread Nigel
In the end I have performed this with the client code making an explicit call to perform the required initialisation. This doesn't feel right, but it works. On Sep 7, 8:12 am, Nigel wrote: > My application needs to be aware of a custom dialog, which is used > only by a custom component.  By "aw

[android-beginners] Re: custom component in a list

2008-07-11 Thread Mark Murphy
> 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 conve

[android-beginners] Re: custom component in a list

2008-07-11 Thread Sylvester Steele
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 do

[android-beginners] Re: custom component in a list

2008-07-11 Thread Mark Murphy
Sylvester Steele wrote: > arrayAdapter1= new ArrayAdapter (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

[android-beginners] Re: custom component in a list

2008-07-11 Thread Sylvester Steele
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 (this, R.layout

[android-beginners] Re: custom component in a list

2008-07-10 Thread Mark Murphy
> 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 Conversation

[android-beginners] Re: custom component in a list

2008-07-10 Thread Sylvester Steele
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);

[android-beginners] Re: custom component in a list

2008-07-09 Thread Mark Murphy
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. > >

[android-beginners] Re: custom component in a list

2008-07-09 Thread Sylvester Steele
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= (Button)this.fin

[android-beginners] Re: custom component in a list

2008-07-08 Thread Sylvester Steele
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 flexibl

[android-beginners] Re: custom component in a list

2008-07-07 Thread Romain Guy
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

[android-beginners] Re: custom component

2008-07-07 Thread Sylvester Steele
1. It used to be that your custom component subclassed AbsoluteLayout. If it still does, I suspect you cannot use LinearLayout.LayoutParams with an AbsoluteLayout. You should make those consistent, either by changing the superclass, or by changing the LayoutParams. I just changed it from Absolute

[android-beginners] Re: custom component

2008-07-07 Thread Mark Murphy
Given the logcat output, the exception is apparently being raised in these lines: this.addView(textView2, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); this.addView(textView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONT

[android-beginners] Re: custom component

2008-07-07 Thread Sylvester Steele
I made the changes you suggested: I got rid of the XML file. My calling class looks like: Log.v("Main activity","before new CustomEditText (this)"); customEditText = new CustomEditText (this); //customEditText = (CustomEditText)this.findViewById(R.layout.component); Log.

[android-beginners] Re: custom component

2008-07-07 Thread Mark Murphy
Sylvester Steele wrote: > even though I can construct, the setItem function gives a null pointer > exception. My guess is, that's because you haven't created the TextView or EditText widgets, and hence they're null. Where are you inflating your XML file? In other words, given that you wrote th