こんにちは、 asynctaskloader を使用して msql db からデータを読み込もうとしています。
int customerid=0;
public void loaddata(int custId) {
customerid = custid;
getLoaderManager().initLoader(0, null, this);
}
@Override public Loader<List<AppEntry>> onCreateLoader(int id, Bundle args) {
// This is called when a new Loader needs to be created. This
// sample only has one Loader with no arguments, so it is simple.
return new AppListLoader(getActivity(),customerid);
}
@Override public void onLoadFinished(Loader<List<AppEntry>> loader, List<AppEntry> data) {
// Set the new data in the adapter.
log.d("price of item",""+data);
}
@Override public void onLoaderReset(Loader<List<AppEntry>> loader) {
// Clear the data in the adapter.
}
アクティビティから loaddata() メソッドを呼び出し、毎回異なる顧客 ID を渡していますが、最初に渡した古い結果しか得られません。他のアダプターと同様に、通知アダプターの変更と呼ばれるものがあります。