IT. Expert System.

Android Reference

LoaderManager


android.app

Class LoaderManager



  • public abstract class LoaderManager
    extends Object
    Interface associated with an Activity or Fragment for managing one or more Loader instances associated with it. This helps an application manage longer-running operations in conjunction with the Activity or Fragment lifecycle; the most common use of this is with a CursorLoader, however applications are free to write their own loaders for loading other types of data. While the LoaderManager API was introduced in Build.VERSION_CODES.HONEYCOMB, a version of the API at is also available for use on older platforms through FragmentActivity. See the blog post Fragments For All for more details.

    As an example, here is the full implementation of a Fragment that displays a ListView containing the results of a query against the contacts content provider. It uses a CursorLoader to manage the query on the provider.

    Developer Guides

    For more information about using loaders, read the Loaders developer guide.

    • Constructor Detail

      • LoaderManager

        public LoaderManager()
    • Method Detail

      • initLoader

        public abstract <D> Loader<D> initLoader(int id,
                               Bundle args,
                               LoaderManager.LoaderCallbacks<D> callback)
        Ensures a loader is initialized and active. If the loader doesn't already exist, one is created and (if the activity/fragment is currently started) starts the loader. Otherwise the last created loader is re-used.

        In either case, the given callback is associated with the loader, and will be called as the loader state changes. If at the point of call the caller is in its started state, and the requested loader already exists and has generated its data, then callback LoaderManager.LoaderCallbacks.onLoadFinished(android.content.Loader<D>, D) will be called immediately (inside of this function), so you must be prepared for this to happen.

        Parameters:
        id - A unique identifier for this loader. Can be whatever you want. Identifiers are scoped to a particular LoaderManager instance.
        args - Optional arguments to supply to the loader at construction. If a loader already exists (a new one does not need to be created), this parameter will be ignored and the last arguments continue to be used.
        callback - Interface the LoaderManager will call to report about changes in the state of the loader. Required.
      • restartLoader

        public abstract <D> Loader<D> restartLoader(int id,
                                  Bundle args,
                                  LoaderManager.LoaderCallbacks<D> callback)
        Starts a new or restarts an existing Loader in this manager, registers the callbacks to it, and (if the activity/fragment is currently started) starts loading it. If a loader with the same id has previously been started it will automatically be destroyed when the new loader completes its work. The callback will be delivered before the old loader is destroyed.
        Parameters:
        id - A unique identifier for this loader. Can be whatever you want. Identifiers are scoped to a particular LoaderManager instance.
        args - Optional arguments to supply to the loader at construction.
        callback - Interface the LoaderManager will call to report about changes in the state of the loader. Required.
      • getLoader

        public abstract <D> Loader<D> getLoader(int id)
        Return the Loader with the given id or null if no matching Loader is found.
      • dump

        public abstract void dump(String prefix,
                FileDescriptor fd,
                PrintWriter writer,
                String[] args)
        Print the LoaderManager's state into the given stream.
        Parameters:
        prefix - Text to print at the front of each line.
        fd - The raw file descriptor that the dump is being sent to.
        writer - A PrintWriter to which the dump is to be set.
        args - Additional arguments to the dump request.
      • enableDebugLogging

        public static void enableDebugLogging(boolean enabled)
        Control whether the framework's internal loader manager debugging logs are turned on. If enabled, you will see output in logcat as the framework performs loader operations.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 972 / . Delta: 0.03892 с