用于打开活动的Android列表视图选择

时间:2011-07-22 18:18:06

标签: android

继承我的代码

package com.momentum.waldo;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class listV extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setListAdapter( new ArrayAdapter<String>(this, R.layout.levels, Levels));

        ListView list = getListView();
        list.setTextFilterEnabled(true);
        list.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                    long arg3) {
                // TODO Auto-generated method stub

            }

        });
    }





    static final String[] Levels = new String [] {
        "Beach", "Carnaval", "Foot ball Stadium", "Santas Work Shop", "Mall"
    };
}

1 个答案:

答案 0 :(得分:1)

请在发布问题之前进行研究。 Android参考资料中提供了大量基本信息。请先阅读此处:http://developer.android.com/reference/android/app/Activity.html#StartingActivities