Android 从另一个活动启动ListActivity

Android 从另一个活动启动ListActivity,android,android-listview,android-intent,Android,Android Listview,Android Intent,我正在创建一个保存GPS坐标的应用程序;我创建了一个按钮,它启动一个新的活动来显示,作为所有保存坐标的列表。我一按下按钮程序就崩溃了,下面是我正在做的 第1类: public void openLatLonData(View view) { Intent intent = new Intent(this, GpsDataList.class); ArrayList<String> allLocalStrings = new Ar

我正在创建一个保存GPS坐标的应用程序;我创建了一个按钮,它启动一个新的活动来显示,作为所有保存坐标的列表。我一按下按钮程序就崩溃了,下面是我正在做的

第1类:

        public void openLatLonData(View view)
    {
        Intent intent = new Intent(this, GpsDataList.class);
        ArrayList<String> allLocalStrings = new ArrayList<String>();
        for(int i =0; i< AllLocals.size();i++)
        {
            allLocalStrings.add(AllLocals.get(i).getLat());
            allLocalStrings.add(AllLocals.get(i).getLon());
        }
        intent.putStringArrayListExtra("data", allLocalStrings);
        startActivity(intent);
    }
{

/**在首次创建活动时调用*/
@凌驾
创建时的公共void(Bundle bundleIn)
{
super.onCreate(bundleIn);
Intent=getIntent();
ArrayList listData=新的ArrayList();
listData=intent.getStringArrayListExtra(“数据”);
此.setListAdapter(新阵列适配器)(此,
android.R.layout.simple_list_item_1,listData));
getListView().setTextFilterEnabled(true);
//完成();
}
}

该按钮包含以下XML:

    <Button android:layout_height="wrap_content" 
android:text="Show Collected Data" 
android:id="@+id/view_lat_lon_data" 
android:layout_width="wrap_content"
android:onClick="openLatLonData">
</Button>

我在res/layout文件夹下添加了一个名为gpsdatalist.xml的新.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

</LinearLayout>

最后,清单包含以下内容:

我相信我已经做好了所有的准备,希望有人能看到错误
提前谢谢各位

您是否在AndroidManifest.xml文件中定义了活动?
无论如何,您最好的线索存在于异常的日志中。检查logcat后,您将在2秒钟内解决此问题。

您需要xml中的列表标记,并确保您已在清单文件中注册了活动。是否对此进行了任何更新?我在这里也发布了一个几乎类似的帖子:你也会犯同样的错误吗?
    <Button android:layout_height="wrap_content" 
android:text="Show Collected Data" 
android:id="@+id/view_lat_lon_data" 
android:layout_width="wrap_content"
android:onClick="openLatLonData">
</Button>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

</LinearLayout>