Jump to content

User:Xvedejas/Android ListView

From Wikipedia, the free encyclopedia
import java.util.*;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class ListTest extends ListActivity
{
    ArrayAdapter<String> adapter;
    @Override public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        adapter = new ArrayAdapter<String>(
            this,
            android.R.layout.simple_list_item_1,
            new String[] {};
            );
        setListAdapter(adapter);
        adapter.add("test");
    }
}