Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在新数组中存储listView的子项_Android_Listview_Android Adapter - Fatal编程技术网

Android 如何在新数组中存储listView的子项

Android 如何在新数组中存储listView的子项,android,listview,android-adapter,Android,Listview,Android Adapter,这是我在xml文件中的listView` <ListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" /> 在我的listView的子项中有电话号码,我想将listView中的所有电话号码复制到一个新数组。为什么不遍历为listView提供信息的光标,然后从中构建数组?@MikeT我不知道如何做,你能给我举

这是我在xml文件中的listView`

 <ListView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

在我的listView的子项中有电话号码,我想将listView中的所有电话号码复制到一个新数组。

为什么不遍历为listView提供信息的光标,然后从中构建数组?@MikeT我不知道如何做,你能给我举个例子吗
 ListView petListView = (ListView) findViewById(R.id.list);
    //attach empty view
    View emptyView = findViewById(R.id.empty_view);
    petListView.setEmptyView(emptyView);
    //no pet data yet so cursor is set to null
    mCursorAdapter = new PetCursorAdapter(this, null);
    petListView.setAdapter(mCursorAdapter);