Well the context was your cwac-merge code, I figured you'd recognize
it.  The code that isn't commented is mine, I just added it to your
code (with an XML button) and it crashed.  You did manage to answer my
question anyway.

I wasn't inflating the XML before adding it to the adapter.

Thanks for your help.

On Oct 23, 6:55 am, Mark Murphy <[email protected]> wrote:
> droid_does wrote:
> > It's surprising that the easiest way to accomplish this effect is
> > creating your own custom adapter.  It does what I want in concept but
> > is there any way to add complex layouts
> > (<LinearLayout>widgets<RelativeLayout>widgets</RelativeLayout></
> > LinearLayout> or predefined XML views?
>
> Yes.
>
> > For example using your demo:
>
> >    private View buildButton() {
>
> >                 //your demo code
> >                 //Button result=new Button(this);
> >            //result.setText("Hello, world!");
>
> >                 //this just crashes, why?
> >                 Button result = (Button)findViewById(R.id.mybutton);
> >                 return result;
>
> >    }
>
> That snippet in isolation means nothing. For starters, my code has
> nothing named mybutton in it (IIRC), so I would not expect that to work.
>
> Any child adapters you add to MergeAdapter can be custom adapters using
> custom rows, and the views you add to MergeAdapter can be views you
> manually inflate from XML via getLayoutInflater().inflate().
>
> > Also, would your approach work for a ListActivity?
>
> Yes.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Training in Germany, 18-22 January 2010:http://bignerdranch.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to