小编Sig*_*sen的帖子

使用SimpleCursorAdapter进行Android ListView更新

嘿,我使用listview来显示存储在数据库中的条目.我还有一个EditText元素和一个按钮,它将EditText的内容添加到数据库中.要将视图绑定到数据库内容,我使用SimpleCursorAdapter和以下populate函数:

private void populate() {
    cursor = dbAdapter.getAllItems();
    startManagingCursor(cursor);

    String[] from = new String[] { DBAdapter.KEY_TASK };
    int[] to = new int[] { android.R.id.text1 };

    // Now create an array adapter and set it to display using our row
    cursorAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, cursor, from, to);
    list.setAdapter(cursorAdapter);
}
Run Code Online (Sandbox Code Playgroud)

如果我添加了一个新条目,通过单击我要刷新列表视图的按钮,但这只适用于populate函数而不适用于公共适配器函数notifyDataSetChanged();.我有错误或者这是刷新列表视图的正确方法吗?

android listview android-listview simplecursoradapter

5
推荐指数
1
解决办法
1万
查看次数

jQuery Mobile锁定方向

嘿家伙我正在使用phonegap和jquery mobile为Android手机构建应用程序.是否有可能将方向锁定在一个页面上?例如,加载页面"地图"并将方向锁定为"横向"模式.

jquery landscape orientation jquery-mobile cordova

3
推荐指数
2
解决办法
3万
查看次数