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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -