LoaderManager with multiple loaders: how to get the right cursorloader

The Loader class has a method called getId(). I would hope this returns the id you've associated with the loader.


Use the getId() method of Loader:

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    switch (loader.getId()) {
        case 0:
            // do some stuff here
            break;
        case 1:
            // do some other stuff here
            break;
        case 2:
            // do some more stuff here
            break;
        default:
            break;
    }
}