NoiseDoll

CursorLoader

Jun 18th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. eventListAdapter = new SimpleCursorAdapter(this,
  2.                 R.layout.event_list_item,
  3.                 null,
  4.                 new String[]{OVirtContract.Event.TIME, OVirtContract.Event.DESCRIPTION},
  5.                 new int[]{R.id.event_timestamp, R.id.event_description}, 0);
  6.  
  7.         panelEvents.setAdapter(eventListAdapter);
  8.         cursorAdapterLoader = new CursorAdapterLoader(eventListAdapter) {
  9.             @Override
  10.             public synchronized Loader<Cursor> onCreateLoader(int id, Bundle args) {
  11.                 final ProviderFacade.QueryBuilder<Event> query = provider.query(Event.class);
  12.                 if (lastHost != null){
  13.                     query.where(HOST_ID, lastHost.getId());
  14.                 }
  15.                 return query.orderByDescending(ID).limit(20).asLoader();
  16.             }
  17.         };
  18.         getLoaderManager().initLoader(0, null, cursorAdapterLoader);
  19.  
  20. Error:(165, 27) error: method initLoader in class LoaderManager cannot be applied to given types;
  21. required: int,Bundle,LoaderCallbacks<D>
  22. found: int,<null>,CursorAdapterLoader
  23. reason: cannot infer type-variable(s) D
  24. (argument mismatch; CursorAdapterLoader cannot be converted to LoaderCallbacks<D>)
  25. where D is a type-variable:
  26. D extends Object declared in method <D>initLoader(int,Bundle,LoaderCallbacks<D>)
Advertisement
Add Comment
Please, Sign In to add comment