This example describes the simple application of Android ListView. Share to everyone for your reference, specific as follows:
What we're going to talk about today is the implementation of ListView in Android. It's divided into four steps, and I'll explain:
Step one : create a new Android project named Listviewdemo.
Step Two: find Listviewdemo.java, the inheritance of our habit of the activity, changed to Listactivity, as follows:
public class Listviewdemo extends listactivity
Step Three: Modify the Listviewdemo.java code method as follows:
Package com.android.test;
Import android.app.ListActivity;
Import Android.os.Bundle;
Import Android.widget.ArrayAdapter;
public class Listviewdemo extends Listactivity {
static final string[] COUNTRIES = new string[]{
"Americian", "Bel Ize "," "", "Japan", "Korean", "Russian"
};
@Override public
void OnCreate (Bundle savedinstancestate) {
super.oncreate (savedinstancestate);
Setlistadapter (New arrayadapter<string> (this,android). R.layout.simple_list_item_1
, COUNTRIES));
}
Step Four: The results of run it (running) are as follows:
Today's dongdong is very easy, I did not write the event.
For more information on Android-related content readers can view the site: "Android View tips Summary", "Android Layout Layout Skills Summary", "Android graphics and image processing skills summary", "Android Development introduction and Advanced Course" , Android Debugging tips and FAQ Solutions Summary, Android Multimedia tips summary (audio, video, audio, etc.), "Android Basic Components Usage Summary" and "Android Control usage Summary"
I hope this article will help you with the Android program.