Isn't this the right way to inflate?
LayoutInflater inflater = (LayoutInflater)this.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
View filmLayout = inflater.inflate(R.layout.filmdetail_layout,
null);
plot = (TextView) filmLayout.findViewById(R.id.plot);
filmdetail_layout is my seperate layout file.. I got a nullpointer
exception when i try to set text in this view..
Do i have to place this in newView like this?
protected View newView(int position, ViewGroup parent) {
TextView txt=new TextView(SackOfViewsDemo.this);
txt.setText(items[(position-2)/2]);
return(txt);
}
On 19 sep, 18:31, Wouter <[email protected]> wrote:
> Ok thank you i will try putting them in seperate layout files now!
>
> Will let you know if this all worked ;)
>
> On 19 sep, 18:28, Mark Murphy <[email protected]> wrote:
>
> > Wouter wrote:
> > > But i have a layout xml file where i declarate all the widgets (yes
> > > its a lot).
> > > Do i have to put this layout file in seperate file (so for all that
> > > has to come above the review list) and then do like this:
>
> > > View v = LayoutInflater.from(this).inflate(your_layout_xml,......);
>
> > > and then add this view to the arraylist of views? (like in the
> > > SackOfViewsDemo).
>
> > > I also have a custom adapter for my listview (list of rows)
>
> > > Or how can i do this the best and easiest? :)
>
> > Either:
>
> > -- Put all of your widgets (outside of the custom adapter) in separate
> > layout files, or
>
> > -- Construct them in Java rather than use layout XML
>
> > It's conceivable to add support for loading a single layout file and
> > pouring all the root's children into the list, but I don't have that in
> > there right now.
>
> > --
> > Mark Murphy (a Commons
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Need help for your Android OSS project?http://wiki.andmob.org/hado
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---