I have a ListView, and I have a custom View, PostView.
How would I go about creating a new PostView(), and adding it to the ListView via .addFooterView(), but still being able to access the object representation of the PostView.
Right now I’m trying:
// the footer
p = new PostView( this );
p.setTargetUri( C.API_CONTENT );
p.setRenderMode( PostView.MODE_TEXT | PostView.MODE_IMAGE );
commentListView.addFooterView( p );
But that is failing, when I try to access the should have been inflated XML components.
Mainly:
public void setRenderMode( int renderMode )
{
this.renderMode = renderMode;
// fails
this.postImagePreview = (ImageView)findViewById( R.id.new_post_image_preview );
}
Am I going about this wrong? I have an onFinishInflate() defined, but maybe I’m prematurely accessing the Views?
The solution for me was to just have a super custom List Adapter, that was capable of returning different types of views, and manually adding a header and footer view around the generated list content.