Example usage for android.app Activity getLoaderManager

List of usage examples for android.app Activity getLoaderManager

Introduction

In this page you can find the example usage for android.app Activity getLoaderManager.

Prototype

@Deprecated
public LoaderManager getLoaderManager() 

Source Link

Document

Return the LoaderManager for this activity, creating it if needed.

Usage

From source file:io.pivotal.arca.fragments.ArcaDispatcherFactory.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static ArcaDispatcher generateDispatcher(android.app.Activity activity) {
    final ContentResolver resolver = activity.getContentResolver();
    final ArcaExecutor executor = new ArcaExecutor.DefaultArcaExecutor(resolver, activity);
    return new ArcaModernDispatcher(executor, activity, activity.getLoaderManager());
}

From source file:org.jboss.aerogear.android.authentication.impl.loader.AuthenticationModuleAdapter.java

public AuthenticationModuleAdapter(Activity activity, AuthenticationModule module, String name) {
    this.module = module;
    this.manager = activity.getLoaderManager();
    this.applicationContext = activity.getApplicationContext();
    this.activity = activity;
    this.fragment = null;
    this.name = name;
    this.handler = new Handler(Looper.getMainLooper());
}

From source file:org.jboss.aerogear.android.pipe.loader.LoaderAdapter.java

public LoaderAdapter(Activity activity, Pipe<T> pipe, String name) {
    this.pipe = pipe;
    this.requestBuilder = pipe.getRequestBuilder();
    this.responseParser = pipe.getResponseParser();
    this.manager = activity.getLoaderManager();
    this.applicationContext = activity.getApplicationContext();
    this.name = name;
    this.handler = new Handler(Looper.getMainLooper());
    this.activity = activity;
}

From source file:de.k3b.android.androFotoFinder.imagedetail.ImagePagerAdapterFromCursor.java

/**
 * Initiates a database requery in a background thread. onLoadFinished() is called when done.
 *///from   w w  w.j  a va  2s  .  c  o  m
private void requery(final Activity context, final String[] sqlProjection, final String from,
        final String sqlWhereStatement, final String sqlSortOrder, final String... sqlWhereParameters) {

    /*
     * Initializes the CursorLoader. The MY_LOADER_ID value is eventually passed
     * to onCreateLoader().
     */

    if (SYNC) {
        // for debugging
        Cursor result = context.getContentResolver().query(Uri.parse(from), // Table to query
                sqlProjection, // Projection to return
                sqlWhereStatement, // No selection clause
                sqlWhereParameters, // No selection arguments
                sqlSortOrder // Default sort order
        );
        onLoadFinished(result);
    } else {
        final int currentLoaderId = ++MY_LOADER_ID;
        context.getLoaderManager().initLoader(currentLoaderId, null,
                new LoaderManager.LoaderCallbacks<Cursor>() {

                    @Override
                    public Loader<Cursor> onCreateLoader(int loaderID, Bundle args) {
                        if (loaderID == currentLoaderId) {
                            // Returns a new CursorLoader
                            return new CursorLoader(context, // Parent activity context
                                    Uri.parse(from), // Table to query
                                    sqlProjection, // Projection to return
                                    sqlWhereStatement, // No selection clause
                                    sqlWhereParameters, // No selection arguments
                                    sqlSortOrder // Default sort order
                            );
                        }
                        return null;
                    }

                    @Override
                    public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
                        ImagePagerAdapterFromCursor.this.onLoadFinished(cursor);
                    }

                    @Override
                    public void onLoaderReset(Loader<Cursor> loader) {
                        ImagePagerAdapterFromCursor.this.onLoadFinished(null);
                    }
                });
    }
}