Wouter wrote:
> 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);
>               }

Probably not. I would just use SackOfViewsAdapter directly (do not
subclass it), and call add() on it for each inflated view you want in
the list. See the onCreate() method in SackOfViewsDemo and how it adds
the clock and buttons.

In your case, if a layout file defines a single item to go into the
list, it would look like:

views.add(inflater.inflate(R.layout.filmdetail_layout, null));

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

Reply via email to