Android - Add Custom View to ListView

Heigueinces

New Member
I have a \[code\]ListView\[/code\], and I have a custom \[code\]View\[/code\], \[code\]PostView\[/code\].How would I go about creating a \[code\]new PostView()\[/code\], and adding it to the \[code\]ListView\[/code\] via \[code\].addFooterView()\[/code\], but still being able to access the object representation of the \[code\]PostView\[/code\].Right now I'm trying:\[code\]// the footerp = new PostView( this );p.setTargetUri( C.API_CONTENT );p.setRenderMode( PostView.MODE_TEXT | PostView.MODE_IMAGE );commentListView.addFooterView( p );\[/code\]But that is failing, when I try to access the should have been inflated XML components. Mainly:\[code\]public void setRenderMode( int renderMode ){ this.renderMode = renderMode; // fails this.postImagePreview = (ImageView)findViewById( R.id.new_post_image_preview );}\[/code\]Am I going about this wrong? I have an \[code\]onFinishInflate()\[/code\] defined, but maybe I'm prematurely accessing the Views?
 
Back
Top