Java 如何将视图动态添加到自定义光标适配器。。?

Java 如何将视图动态添加到自定义光标适配器。。?,java,android,sqlite,listview,Java,Android,Sqlite,Listview,如何将视图动态添加到自定义光标适配器。。其中列表视图的每一行看起来像 <?XML version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_width="f

如何将视图动态添加到自定义光标适配器。。其中列表视图的每一行看起来像

<?XML version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:orientation="horizontal"
android:layout_width="fill_parent">



<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_weight=".9"
android:id="@+id/book_name" android:text="Default"
android:textStyle="bold" />




<TextView
    android:id="@+id/tick"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="right"
    android:text="NOT ADDED" />

</LinearLayout>
我使用SimpleCrsorAdapter是因为我想通过数据库访问数据。。。
现在,当活动正在运行时,数据库中有一些插入,我必须在列表视图上显示这些插入。

当数据更改时,您必须使用

changeCursor(your_new_cursor);

您之前给适配器的光标将被关闭。

您应该使用CustomAdapter并覆盖getView(position)来实现此功能。

插入意味着什么,您想要什么,发生了什么?实际上添加了更多的条目,或者您可以说插入了一些新行。。。因此,我还需要显示这些新添加的行…如何添加新行我的意思是,任何按钮单击和添加新行都将被清除…在按钮单击后,添加新行…现在如果我更改光标,则必须从一开始就执行新光标的计算,即它将再次从头创建列表视图。。。。但我只想添加新插入的行。。比如说,前面我在数据库中有10行,所以列表视图中有10个项目,现在我在列表视图中增加了1行,所以相应地增加了11个项目,但是我只想计算这个额外添加的行,也不想计算前面10行。。。。
changeCursor(your_new_cursor);