AsyncLayoutInflater
public
final
class
AsyncLayoutInflater
extends Object
Helper class for inflating layouts asynchronously. To use, construct
an instance of AsyncLayoutInflater
on the UI thread and call
inflate(int, ViewGroup, OnInflateFinishedListener)
. The
AsyncLayoutInflater.OnInflateFinishedListener
will be invoked on the UI thread
when the inflate request has completed.
This is intended for parts of the UI that are created lazily or in
response to user interactions. This allows the UI thread to continue
to be responsive & animate while the relatively heavy inflate
is being performed.
For a layout to be inflated asynchronously it needs to have a parent
whose generateLayoutParams(AttributeSet)
is thread-safe
and all the Views being constructed as part of inflation must not create
any Handler
s or otherwise call myLooper()
. If the
layout that is trying to be inflated cannot be constructed
asynchronously for whatever reason, AsyncLayoutInflater
will
automatically fall back to inflating on the UI thread.
NOTE that the inflated View hierarchy is NOT added to the parent. It is
equivalent to calling inflate(int, ViewGroup, boolean)
with attachToRoot set to false. Callers will likely want to call
addView(View)
in the AsyncLayoutInflater.OnInflateFinishedListener
callback at a minimum.
This inflater does not support setting a LayoutInflater.Factory
nor LayoutInflater.Factory2
. Similarly it does not support inflating
layouts that contain fragments.
Summary
Nested classes |
interface |
AsyncLayoutInflater.OnInflateFinishedListener
|
Inherited methods |
From
class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long millis, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long millis)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
|
Public constructors
AsyncLayoutInflater
AsyncLayoutInflater (Context context)
Parameters |
context |
Context
|
Public methods
Annotations
Interfaces
Classes
This site uses cookies to store your preferences for site-specific language and display options.
This doc is hidden because your selected API level for the
documentation is . You can change the
documentation API level with the selector above the left navigation.
For more information about specifying the API level your app requires,
read Supporting
Different Platform Versions.