Android examples for android.widget:ListView
Create or recycle View inside a listview.
import android.content.Context; import android.view.LayoutInflater; import android.view.View; public class Main{ /**//from w w w. java2 s. c o m * Create or recycle View inside a listview. * * @param c : Android context. * @param v : list view item. * @param layoutId : Unique identifier for the ressource layout. * @return a new or recycled item. */ public static View recycleOrCreateView(Context c, View v, int layoutId) { if (v == null) { LayoutInflater vi = (LayoutInflater) c .getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(layoutId, null); GenericViewHolder vh = new GenericViewHolder(v); v.setTag(vh); } return v; } }