fill value to ArrayAdapter - Android android.widget

Android examples for android.widget:Adapter

Description

fill value to ArrayAdapter

Demo Code


//package com.java2s;

import android.widget.ArrayAdapter;

import java.util.List;

public class Main {
    public static void fillLeftList(String[] pairsList,
            List<String> namesList, ArrayAdapter<String> adapter) {
        String[] names;//from w  ww .  j av a2 s .co  m
        if (pairsList.length != 0) {
            namesList.clear();
            for (String s : pairsList) {
                names = s.split("-");
                if (!namesList.contains(names[0])) {
                    namesList.add(names[0]);
                }
            }
            if (adapter != null) {
                adapter.notifyDataSetChanged();
            }
        }
    }
}

Related Tutorials