Tuesday, September 18, 2012

ListView with image android


ListView is core component of android. Its feature of binding data dynamically and efficient loading is awesome. It give us lots of command and make our task easy.

There are three component in Listview Android

  • ListView Control Widget
  • Base Adapter
  • Activity
Base Adapter is used to bind data dynamically inside Listrow. So these are the few basic steps to create a Listview in Android

Step 1). Create Two Layout, one for Listview and activity background Second for ListView Row


Step 2) Create one Activity as controller to control and work like a bridge between BaseAdapter and Layout


Step 3) Adapter( or so called BaseAdapter)

You can download source code and play with it. This code output will be like that

Complex ListView
ListView With Image
Biggest advantage of using BaseAdapter and ListView, is its efficient loading capacity. BaseAdapter bind view to ListView when every row created first time then it keeps all already created row in memory and load them from memory. This make ListView damn fast

In my code i have Holder class that make sure that we will inflate a row layout only when row is created first time
                                                                      

                                                          Download Source Code

No comments:

Post a Comment