Java Code Examples for android.support.v4.content.Loader#isStarted()

The following examples show how to use android.support.v4.content.Loader#isStarted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExplorerActivity.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void addConnection(OpenMode service) {

    try {
        if (cloudHandler.findEntry(service) != null) {
            // cloud entry already exists
            Toast.makeText(this, getResources().getString(R.string.connection_exists),
			   Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(ExplorerActivity.this, getResources().getString(R.string.please_wait), Toast.LENGTH_LONG).show();
            Bundle args = new Bundle();
            args.putInt(ARGS_KEY_LOADER, service.ordinal());

            // check if we already had done some work on the loader
            Loader loader = getSupportLoaderManager().getLoader(REQUEST_CODE_CLOUD_LIST_KEY);
            if (loader != null && loader.isStarted()) {
                // making sure that loader is not started
                getSupportLoaderManager().destroyLoader(REQUEST_CODE_CLOUD_LIST_KEY);
            }
            getSupportLoaderManager().initLoader(REQUEST_CODE_CLOUD_LIST_KEY, args, this);
        }
    } catch (CloudPluginException e) {
        e.printStackTrace();
        Toast.makeText(this, getResources().getString(R.string.cloud_error_plugin),
		   Toast.LENGTH_LONG).show();
    }
}
 
Example 2
Source File: BlockListFragment.java    From bither-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onLoadFinished(final Loader<List<Block>> loader,
                           final List<Block> blocks) {
    adapter.replace(blocks);

    final Loader<Set<Tx>> transactionLoader = loaderManager
            .getLoader(ID_TRANSACTION_LOADER);
    if (transactionLoader != null && transactionLoader.isStarted())
        transactionLoader.forceLoad();
}
 
Example 3
Source File: LocalResourceSelectDialog.java    From android_maplibui with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void runLoader()
{
    int id = R.id.local_resources_loader;
    Loader loader = getLoaderManager().getLoader(id);
    if (null != loader && loader.isStarted()) {
        getLoaderManager().restartLoader(id, null, this);
    } else {
        getLoaderManager().initLoader(id, null, this);
    }
}