嘿,我使用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();.我有错误或者这是刷新列表视图的正确方法吗?
嘿家伙我正在使用phonegap和jquery mobile为Android手机构建应用程序.是否有可能将方向锁定在一个页面上?例如,加载页面"地图"并将方向锁定为"横向"模式.