public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
Modifier and Type | Class and Description |
---|---|
static interface |
RemoteViewsAdapter.RemoteAdapterConnectionCallback
An interface for the RemoteAdapter to notify other classes when adapters
are actually connected to/disconnected from their actual services.
|
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
Constructor and Description |
---|
RemoteViewsAdapter(Context context,
Intent intent,
RemoteViewsAdapter.RemoteAdapterConnectionCallback callback) |
Modifier and Type | Method and Description |
---|---|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
int |
getCount()
How many items are in the data set represented by this Adapter.
|
Object |
getItem(int position)
Get the data item associated with the specified position in the data set.
|
long |
getItemId(int position)
Get the row id associated with the specified position in the list.
|
int |
getItemViewType(int position)
Get the type of View that will be created by
Adapter.getView(int, android.view.View, android.view.ViewGroup) for the specified item. |
Intent |
getRemoteViewsServiceIntent() |
View |
getView(int position,
View convertView,
ViewGroup parent)
Get a View that displays the data at the specified position in the data set.
|
int |
getViewTypeCount()
Returns the number of types of Views that will be created by
Adapter.getView(int, android.view.View, android.view.ViewGroup) . |
boolean |
handleMessage(Message msg) |
boolean |
hasStableIds()
Indicates whether the item ids are stable across changes to the
underlying data.
|
boolean |
isDataReady() |
boolean |
isEmpty() |
void |
notifyDataSetChanged()
Notifies the attached observers that the underlying data has been changed
and any View reflecting the data set should refresh itself.
|
void |
saveRemoteViewsCache() |
void |
setRemoteViewsOnClickHandler(RemoteViews.OnClickHandler handler) |
void |
setVisibleRangeHint(int lowerBound,
int upperBound)
This method allows an AdapterView using this Adapter to provide information about which
views are currently being displayed.
|
areAllItemsEnabled, getDropDownView, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
public RemoteViewsAdapter(Context context, Intent intent, RemoteViewsAdapter.RemoteAdapterConnectionCallback callback)
protected void finalize() throws Throwable
Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the JavaTM virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
public boolean isDataReady()
public void setRemoteViewsOnClickHandler(RemoteViews.OnClickHandler handler)
public void saveRemoteViewsCache()
public Intent getRemoteViewsServiceIntent()
public int getCount()
Adapter
public Object getItem(int position)
Adapter
public long getItemId(int position)
Adapter
public int getItemViewType(int position)
Adapter
Adapter.getView(int, android.view.View, android.view.ViewGroup)
for the specified item.getItemViewType
in interface Adapter
getItemViewType
in class BaseAdapter
position
- The position of the item within the adapter's data set whose view type we
want.Adapter.getView(int, android.view.View, android.view.ViewGroup)
. Note: Integers must be in the
range 0 to Adapter.getViewTypeCount()
- 1. Adapter.IGNORE_ITEM_VIEW_TYPE
can
also be returned.Adapter.IGNORE_ITEM_VIEW_TYPE
public void setVisibleRangeHint(int lowerBound, int upperBound)
public View getView(int position, View convertView, ViewGroup parent)
Adapter
LayoutInflater.inflate(int, android.view.ViewGroup, boolean)
to specify a root view and to prevent attachment to the root.getView
in interface Adapter
position
- The position of the item within the adapter's data set of the item whose view
we want.convertView
- The old view to reuse, if possible. Note: You should check that this view
is non-null and of an appropriate type before using. If it is not possible to convert
this view to display the correct data, this method can create a new view.
Heterogeneous lists can specify their number of view types, so that this View is
always of the right type (see Adapter.getViewTypeCount()
and
Adapter.getItemViewType(int)
).parent
- The parent that this view will eventually be attached topublic int getViewTypeCount()
Adapter
Returns the number of types of Views that will be created by
Adapter.getView(int, android.view.View, android.view.ViewGroup)
. Each type represents a set of views that can be
converted in Adapter.getView(int, android.view.View, android.view.ViewGroup)
. If the adapter always returns the same
type of View for all items, this method should return 1.
This method will only be called when the adapter is set on the AdapterView
.
getViewTypeCount
in interface Adapter
getViewTypeCount
in class BaseAdapter
public boolean hasStableIds()
Adapter
hasStableIds
in interface Adapter
hasStableIds
in class BaseAdapter
public boolean isEmpty()
isEmpty
in interface Adapter
isEmpty
in class BaseAdapter
public void notifyDataSetChanged()
BaseAdapter
notifyDataSetChanged
in class BaseAdapter
public boolean handleMessage(Message msg)
handleMessage
in interface Handler.Callback