populate View with Adapter - Android User Interface

Android examples for User Interface:View

Description

populate View with Adapter

Demo Code


//package com.java2s;
import android.view.ViewGroup;
import android.widget.Adapter;

public class Main {
    public static void populateView(ViewGroup viewGroup, Adapter adapter) {
        for (int position = 0; position < adapter.getCount(); position++) {
            viewGroup.addView(adapter.getView(position, null, viewGroup));
        }//  w  ww  .ja  va2s .  c  om
    }
}

Related Tutorials