我有这个方法来填充 GridView
private void populateGrid()
{
GridView gv= (GridView)findViewById(R.id.mygrid);
Cursor c = getData():
startManagingCursor(c);
String[] cols = new String[] { adap.ONE, adap.TWO, adap.THREE};
int[] views = new int[] { R.id.txt_1, R.id.txt_2, R.id.txt_3};
// Now create an array adapter and set it to display using our row
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.row, c, cols, views);
Log.w("NumRows",adapter.getCount() + "");
gv.setAdapter(adapter);
}
不幸的是方法
startManagingCursor(c);
而这个构造函数
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.listviewtemp, c, cols, views);
自 API 级别 11 起已弃用。
我应该如何重写这个简单的方法以避免弃用?