android - Need to add text using adapter -


need add text's , image's using adapter shown below, image , text should passed adapter (not xml file), new android please share code.

if need add textview , imageview programmatically in adapter can that:

    public view getview(int position, view convertview, viewgroup parent) {         //create cell layout         linearlayout layout = new linearlayout(context);         layout.setlayoutparams(new abslistview.layoutparams(                 abslistview.layoutparams.match_parent,                 abslistview.layoutparams.match_parent));         layout.setorientation(linearlayout.horizontal);         //create textview         textview textview = new textview(context);         //create imageview          imageview imageview = new imageview(context);          //add them cell layout          layout.addview(textview);         layour.addview(imageview);      } 

i recommend use viewholder pattern can find here or search, saves memory reusing views on screen rather creating new 1 every time.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -