Android 如何在新数组中存储listView的子项
这是我在xml文件中的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我不知道如何做,你能给我举
<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);