Hello, i have problem with using this code: 
developer.android.com/guide/topics/ui/layout/listview.html
I used the code, everything same, but i had error at this part:

getLoaderManager().initLoader(0, null, this);


This is exception. It has problem with "this":

(MainActivity looking like: public class MainActivity extends ListActivity 
implements LoaderManager.LoaderCallbacks<Cursor>)

Error:(71, 27) error: method initLoader in class LoaderManager cannot be 
applied to given types;
required: int,Bundle,LoaderCallbacks<D>
found: int,<null>,MainActivity
reason: cannot infer type-variable(s) D
(argument mismatch; MainActivity cannot be converted to LoaderCallbacks<D>)
where D is a type-variable:
D extends Object declared in method 
<D>initLoader(int,Bundle,LoaderCallbacks<D>)

Okey, so i tried to make new loader like:

android.app.LoaderManager.LoaderCallbacks<Cursor> loader = new 
android.app.LoaderManager.LoaderCallbacks<Cursor>() {

public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new CursorLoader(getApplicationContext(), 
ContactsContract.Data.CONTENT_URI,
PROJECTION, SELECTION, null, null);
}

public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
mAdapter.swapCursor(data);
}

public void onLoaderReset(Loader<Cursor> loader) {
mAdapter.swapCursor(null);
}
}

And used "loader" instead of "this" (initLoader(0, null, loader)), but i 
wasnt working too, because of incompatibilty Loader<Cursor> and CursorLoader
 in:

public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(getApplicationContext(), 
ContactsContract.Data.CONTENT_URI,
            PROJECTION, SELECTION, null, null);

}    

Please, can someone help me with solving this problem? 
Thanks very much, Sebastian :)

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/bc7acca8-e81c-4467-a927-75fbfd3cee4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to