0
我試圖綁定一個客戶的ContentProvider我的活動,擁有一個GridView我怎麼一個GridView綁定到一個自定義的ContentProvider
String[] projection = { SAppsDatabase.ID, SAppsDatabase.COL_APP_TITLE};
String[] uiBindFrom = { SAppsDatabase.COL_APP_TITLE };
int[] uiBindTo = { R.id.title };
Cursor apps = managedQuery(
MyProvider.CONTENT_URI, projection, null, null, null);
GridView gridview = (GridView) findViewById(R.id.gridview);
CursorAdapter adapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.grid_app_list, apps,
uiBindFrom, uiBindTo);
gridview.setAdapter(adapter);
這是行不通的。
我設法通過與上面相同的方式將它綁定到ListActivity,並設置: setListAdapter(adapter);
謝謝拉維。我想我可以解決這個問題。看來我需要將ContentProvider包裝在BaseAdapter中。 – andydev
你能解決這個問題嗎? – bluefalcon
當我回到開發的這一部分,並實現包裝,我會在這裏發佈 – andydev