Skip to content

Instantly share code, notes, and snippets.

@leonguyen
Last active December 16, 2015 14:39
Show Gist options
  • Select an option

  • Save leonguyen/5450482 to your computer and use it in GitHub Desktop.

Select an option

Save leonguyen/5450482 to your computer and use it in GitHub Desktop.
Android Lab: List View with Custom Adapter - Create List View Activity
package com.example.androidlab;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ListView;
public class MainActivity extends ListActivity {
static final String[] arrOS = new String[] { "Android", "iPhone",
"WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7",
"Max OS X", "Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X",
"Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2",
"Android", "iPhone", "WindowsMobile" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new CustomAdapter(this, R.layout.list_item, arrOS));
ListView listView = getListView();
listView.setTextFilterEnabled(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment