RemoteViews
public
class
RemoteViews
extends Object
implements
Parcelable,
LayoutInflater.Filter
| java.lang.Object | |
| ↳ | android.widget.RemoteViews |
A class that describes a view hierarchy that can be displayed in another process. The hierarchy is inflated from a layout resource file, and this class provides some basic operations for modifying the content of the inflated hierarchy.
RemoteViews is limited to support for the following layouts:
AdapterViewFlipperFrameLayoutGridLayoutGridViewLinearLayoutListViewRelativeLayoutStackViewViewFlipper
And the following widgets:
Descendants of these classes are not supported.
Summary
Nested classes | |
|---|---|
class |
RemoteViews.ActionException
Exception to send when something goes wrong executing an action |
class |
RemoteViews.RemoteResponse
Class representing a response to an action performed on any element of a RemoteViews. |
@interface |
RemoteViews.RemoteView
This annotation indicates that a subclass of View is allowed to be used
with the |
Constants | |
|---|---|
String |
EXTRA_SHARED_ELEMENT_BOUNDS
The intent extra that contains the bounds for all shared elements. |
Inherited constants |
|---|
Fields | |
|---|---|
public
static
final
Creator<RemoteViews> |
CREATOR
Parcelable.Creator that instantiates RemoteViews objects |
Public constructors | |
|---|---|
RemoteViews(String packageName, int layoutId)
Create a new RemoteViews object that will display the views contained in the specified layout file. |
|
RemoteViews(RemoteViews landscape, RemoteViews portrait)
Create a new RemoteViews object that will inflate as the specified landspace or portrait RemoteViews, depending on the current configuration. |
|
RemoteViews(RemoteViews src)
Creates a copy of another RemoteViews. |
|
RemoteViews(Parcel parcel)
Reads a RemoteViews object from a parcel. |
|
Public methods | |
|---|---|
void
|
addView(int viewId, RemoteViews nestedView)
Equivalent to calling |
View
|
apply(Context context, ViewGroup parent)
Inflates the view hierarchy represented by this object and applies all of the actions. |
RemoteViews
|
clone()
This method was deprecated
in API level 28.
use |
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
int
|
getLayoutId()
Returns the layout id of the root layout associated with this RemoteViews. |
String
|
getPackage()
|
boolean
|
onLoadClass(Class clazz)
This method is deprecated.
Used by system to enforce safe inflation of |
void
|
reapply(Context context, View v)
Applies all of the actions to the provided view. |
void
|
removeAllViews(int viewId)
Equivalent to calling |
void
|
setAccessibilityTraversalAfter(int viewId, int nextId)
Equivalent to calling |
void
|
setAccessibilityTraversalBefore(int viewId, int nextId)
Equivalent to calling |
void
|
setBitmap(int viewId, String methodName, Bitmap value)
Call a method taking one Bitmap on a view in the layout for this RemoteViews. |
void
|
setBoolean(int viewId, String methodName, boolean value)
Call a method taking one boolean on a view in the layout for this RemoteViews. |
void
|
setBundle(int viewId, String methodName, Bundle value)
Call a method taking one Bundle on a view in the layout for this RemoteViews. |
void
|
setByte(int viewId, String methodName, byte value)
Call a method taking one byte on a view in the layout for this RemoteViews. |
void
|
setChar(int viewId, String methodName, char value)
Call a method taking one char on a view in the layout for this RemoteViews. |
void
|
setCharSequence(int viewId, String methodName, CharSequence value)
Call a method taking one CharSequence on a view in the layout for this RemoteViews. |
void
|
setChronometer(int viewId, long base, String format, boolean started)
Equivalent to calling |
void
|
setChronometerCountDown(int viewId, boolean isCountDown)
Equivalent to calling |
void
|
setContentDescription(int viewId, CharSequence contentDescription)
Equivalent to calling View.setContentDescription(CharSequence). |
void
|
setDisplayedChild(int viewId, int childIndex)
Equivalent to calling |
void
|
setDouble(int viewId, String methodName, double value)
Call a method taking one double on a view in the layout for this RemoteViews. |
void
|
setEmptyView(int viewId, int emptyViewId)
Equivalent to calling |
void
|
setFloat(int viewId, String methodName, float value)
Call a method taking one float on a view in the layout for this RemoteViews. |
void
|
setIcon(int viewId, String methodName, Icon value)
Call a method taking one Icon on a view in the layout for this RemoteViews. |
void
|
setImageViewBitmap(int viewId, Bitmap bitmap)
Equivalent to calling |
void
|
setImageViewIcon(int viewId, Icon icon)
Equivalent to calling |
void
|
setImageViewResource(int viewId, int srcId)
Equivalent to calling |
void
|
setImageViewUri(int viewId, Uri uri)
Equivalent to calling |
void
|
setInt(int viewId, String methodName, int value)
Call a method taking one int on a view in the layout for this RemoteViews. |
void
|
setIntent(int viewId, String methodName, Intent value)
Call a method taking one Intent on a view in the layout for this RemoteViews. |
void
|
setLabelFor(int viewId, int labeledId)
Equivalent to calling |
void
|
setLightBackgroundLayoutId(int layoutId)
Provides an alternate layout ID, which can be used to inflate this view. |
void
|
setLong(int viewId, String methodName, long value)
Call a method taking one long on a view in the layout for this RemoteViews. |
void
|
setOnClickFillInIntent(int viewId, Intent fillInIntent)
When using collections (eg. |
void
|
setOnClickPendingIntent(int viewId, PendingIntent pendingIntent)
Equivalent to calling
|
void
|
setOnClickResponse(int viewId, RemoteViews.RemoteResponse response)
Equivalent of calling
|
void
|
setPendingIntentTemplate(int viewId, PendingIntent pendingIntentTemplate)
When using collections (eg. |
void
|
setProgressBar(int viewId, int max, int progress, boolean indeterminate)
Equivalent to calling |
void
|
setRelativeScrollPosition(int viewId, int offset)
Equivalent to calling |
void
|
setRemoteAdapter(int appWidgetId, int viewId, Intent intent)
This method was deprecated
in API level 15.
This method has been deprecated. See
|
void
|
setRemoteAdapter(int viewId, Intent intent)
Equivalent to calling |
void
|
setScrollPosition(int viewId, int position)
Equivalent to calling |
void
|
setShort(int viewId, String methodName, short value)
Call a method taking one short on a view in the layout for this RemoteViews. |
void
|
setString(int viewId, String methodName, String value)
Call a method taking one String on a view in the layout for this RemoteViews. |
void
|
setTextColor(int viewId, int color)
Equivalent to calling |
void
|
setTextViewCompoundDrawables(int viewId, int left, int top, int right, int bottom)
Equivalent to calling
|
void
|
setTextViewCompoundDrawablesRelative(int viewId, int start, int top, int end, int bottom)
Equivalent to calling |
void
|
setTextViewText(int viewId, CharSequence text)
Equivalent to calling |
void
|
setTextViewTextSize(int viewId, int units, float size)
Equivalent to calling |
void
|
setUri(int viewId, String methodName, Uri value)
Call a method taking one Uri on a view in the layout for this RemoteViews. |
void
|
setViewPadding(int viewId, int left, int top, int right, int bottom)
Equivalent to calling |
void
|
setViewVisibility(int viewId, int visibility)
Equivalent to calling |
void
|
showNext(int viewId)
Equivalent to calling |
void
|
showPrevious(int viewId)
Equivalent to calling |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
|---|---|
Constants
EXTRA_SHARED_ELEMENT_BOUNDS
public static final String EXTRA_SHARED_ELEMENT_BOUNDS
The intent extra that contains the bounds for all shared elements.
Constant Value: "android.widget.extra.SHARED_ELEMENT_BOUNDS"
Fields
CREATOR
public static final Creator<RemoteViews> CREATOR
Parcelable.Creator that instantiates RemoteViews objects
Public constructors
RemoteViews
public RemoteViews (String packageName, int layoutId)
Create a new RemoteViews object that will display the views contained in the specified layout file.
| Parameters | |
|---|---|
packageName |
String: Name of the package that contains the layout resource |
layoutId |
int: The id of the layout resource |
RemoteViews
public RemoteViews (RemoteViews landscape, RemoteViews portrait)
Create a new RemoteViews object that will inflate as the specified landspace or portrait RemoteViews, depending on the current configuration.
| Parameters | |
|---|---|
landscape |
RemoteViews: The RemoteViews to inflate in landscape configuration |
portrait |
RemoteViews: The RemoteViews to inflate in portrait configuration |
RemoteViews
public RemoteViews (RemoteViews src)
Creates a copy of another RemoteViews.
| Parameters | |
|---|---|
src |
RemoteViews |
RemoteViews
public RemoteViews (Parcel parcel)
Reads a RemoteViews object from a parcel.
Public methods
addView
public void addView (int viewId,
RemoteViews nestedView)
Equivalent to calling ViewGroup#addView(View) after inflating the
given RemoteViews. This allows users to build "nested"
RemoteViews. In cases where consumers of RemoteViews may
recycle layouts, use removeAllViews(int) to clear any existing
children.
| Parameters | |
|---|---|
viewId |
int: The id of the parent ViewGroup to add child into. |
nestedView |
RemoteViews: RemoteViews that describes the child. |
apply
public View apply (Context context, ViewGroup parent)
Inflates the view hierarchy represented by this object and applies all of the actions.
Caller beware: this may throw
| Parameters | |
|---|---|
context |
Context: Default context to use |
parent |
ViewGroup: Parent that the resulting view hierarchy will be attached to. This method
does not attach the hierarchy. The caller should do so when appropriate. |
| Returns | |
|---|---|
View |
The inflated view hierarchy |
clone
public RemoteViews clone ()
This method was deprecated
in API level 28.
use RemoteViews(android.widget.RemoteViews) instead.
Returns a deep copy of the RemoteViews object. The RemoteView may not be attached to another RemoteView -- it must be the root of a hierarchy.
| Returns | |
|---|---|
RemoteViews |
a clone of this instance. |
| Throws | |
|---|---|
IllegalStateException |
if this is not the root of a RemoteView hierarchy |
describeContents
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(android.os.Parcel, int),
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR bit.
| Returns | |
|---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
getLayoutId
public int getLayoutId ()
Returns the layout id of the root layout associated with this RemoteViews. In the case that the RemoteViews has both a landscape and portrait root, this will return the layout id associated with the portrait layout.
| Returns | |
|---|---|
int |
the layout id. |
onLoadClass
public boolean onLoadClass (Class clazz)
This method is deprecated.
Used by system to enforce safe inflation of RemoteViews. Apps should not
override this method. Changing of this method will NOT affect the process where RemoteViews
is rendered.
Used to restrict the views which can be inflated
| Parameters | |
|---|---|
clazz |
Class: The class object for the View that is about to be inflated |
| Returns | |
|---|---|
boolean |
True if this class is allowed to be inflated, or false otherwise |
reapply
public void reapply (Context context, View v)
Applies all of the actions to the provided view.
Caller beware: this may throw
| Parameters | |
|---|---|
context |
Context |
v |
View: The view to apply the actions to. This should be the result of
the apply(android.content.Context, android.view.ViewGroup) call. |
removeAllViews
public void removeAllViews (int viewId)
Equivalent to calling ViewGroup#removeAllViews().
| Parameters | |
|---|---|
viewId |
int: The id of the parent ViewGroup to remove all
children from. |
setAccessibilityTraversalAfter
public void setAccessibilityTraversalAfter (int viewId,
int nextId)
Equivalent to calling View.setAccessibilityTraversalAfter(int).
| Parameters | |
|---|---|
viewId |
int: The id of the view whose after view in accessibility traversal to set. |
nextId |
int: The id of the next in the accessibility traversal. |
setAccessibilityTraversalBefore
public void setAccessibilityTraversalBefore (int viewId,
int nextId)
Equivalent to calling View.setAccessibilityTraversalBefore(int).
| Parameters | |
|---|---|
viewId |
int: The id of the view whose before view in accessibility traversal to set. |
nextId |
int: The id of the next in the accessibility traversal. |
setBitmap
public void setBitmap (int viewId,
String methodName,
Bitmap value)
Call a method taking one Bitmap on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
Bitmap: The value to pass to the method. |
setBoolean
public void setBoolean (int viewId,
String methodName,
boolean value)
Call a method taking one boolean on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
boolean: The value to pass to the method. |
setBundle
public void setBundle (int viewId,
String methodName,
Bundle value)
Call a method taking one Bundle on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
Bundle: The value to pass to the method. |
setByte
public void setByte (int viewId,
String methodName,
byte value)
Call a method taking one byte on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
byte: The value to pass to the method. |
setChar
public void setChar (int viewId,
String methodName,
char value)
Call a method taking one char on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
char: The value to pass to the method. |
setCharSequence
public void setCharSequence (int viewId,
String methodName,
CharSequence value)
Call a method taking one CharSequence on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
CharSequence: The value to pass to the method. |
setChronometer
public void setChronometer (int viewId,
long base,
String format,
boolean started)
Equivalent to calling Chronometer#setBase,
Chronometer#setFormat,
and Chronometer#start or
Chronometer#stop.
| Parameters | |
|---|---|
viewId |
int: The id of the Chronometer to change |
base |
long: The time at which the timer would have read 0:00. This
time should be based off of
SystemClock.elapsedRealtime(). |
format |
String: The Chronometer format string, or null to
simply display the timer value. |
started |
boolean: True if you want the clock to be started, false if not. |
See also:
setChronometerCountDown
public void setChronometerCountDown (int viewId,
boolean isCountDown)
Equivalent to calling Chronometer#setCountDown(boolean) on
the chronometer with the given viewId.
| Parameters | |
|---|---|
viewId |
int: The id of the Chronometer to change |
isCountDown |
boolean: True if you want the chronometer to count down to base instead of
counting up. |
setContentDescription
public void setContentDescription (int viewId,
CharSequence contentDescription)
Equivalent to calling View.setContentDescription(CharSequence).
| Parameters | |
|---|---|
viewId |
int: The id of the view whose content description should change. |
contentDescription |
CharSequence: The new content description for the view. |
setDisplayedChild
public void setDisplayedChild (int viewId,
int childIndex)
Equivalent to calling AdapterViewAnimator#setDisplayedChild(int)
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call
AdapterViewAnimator#setDisplayedChild(int) |
childIndex |
int |
setDouble
public void setDouble (int viewId,
String methodName,
double value)
Call a method taking one double on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
double: The value to pass to the method. |
setEmptyView
public void setEmptyView (int viewId,
int emptyViewId)
Equivalent to calling AdapterView#setEmptyView(View)
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to set the empty view |
emptyViewId |
int: The view id of the empty view |
setFloat
public void setFloat (int viewId,
String methodName,
float value)
Call a method taking one float on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
float: The value to pass to the method. |
setIcon
public void setIcon (int viewId,
String methodName,
Icon value)
Call a method taking one Icon on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
Icon: The Icon to pass the method. |
setImageViewBitmap
public void setImageViewBitmap (int viewId,
Bitmap bitmap)
Equivalent to calling ImageView#setImageBitmap(Bitmap)
| Parameters | |
|---|---|
viewId |
int: The id of the view whose bitmap should change |
bitmap |
Bitmap: The new Bitmap for the drawable |
setImageViewIcon
public void setImageViewIcon (int viewId,
Icon icon)
Equivalent to calling ImageView#setImageIcon(Icon)
| Parameters | |
|---|---|
viewId |
int: The id of the view whose bitmap should change |
icon |
Icon: The new Icon for the ImageView |
setImageViewResource
public void setImageViewResource (int viewId,
int srcId)
Equivalent to calling ImageView#setImageResource(int)
| Parameters | |
|---|---|
viewId |
int: The id of the view whose drawable should change |
srcId |
int: The new resource id for the drawable |
setImageViewUri
public void setImageViewUri (int viewId,
Uri uri)
Equivalent to calling ImageView#setImageURI(Uri)
| Parameters | |
|---|---|
viewId |
int: The id of the view whose drawable should change |
uri |
Uri: The Uri for the image |
setInt
public void setInt (int viewId,
String methodName,
int value)
Call a method taking one int on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
int: The value to pass to the method. |
setIntent
public void setIntent (int viewId,
String methodName,
Intent value)
Call a method taking one Intent on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
Intent: The Intent to pass the method. |
setLabelFor
public void setLabelFor (int viewId,
int labeledId)
Equivalent to calling View#setLabelFor(int).
| Parameters | |
|---|---|
viewId |
int: The id of the view whose property to set. |
labeledId |
int: The id of a view for which this view serves as a label. |
setLightBackgroundLayoutId
public void setLightBackgroundLayoutId (int layoutId)
Provides an alternate layout ID, which can be used to inflate this view. This layout will be used by the host when the widgets displayed on a light-background where foreground elements and text can safely draw using a dark color without any additional background protection.
| Parameters | |
|---|---|
layoutId |
int |
setLong
public void setLong (int viewId,
String methodName,
long value)
Call a method taking one long on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
long: The value to pass to the method. |
setOnClickFillInIntent
public void setOnClickFillInIntent (int viewId,
Intent fillInIntent)
When using collections (eg. ListView, StackView etc.) in widgets, it is very
costly to set PendingIntents on the individual items, and is hence not recommended. Instead
a single PendingIntent template can be set on the collection, see RemoteViews#setPendingIntentTemplate(int, PendingIntent), and the individual on-click
action of a given item can be distinguished by setting a fillInIntent on that item. The
fillInIntent is then combined with the PendingIntent template in order to determine the final
intent which will be executed when the item is clicked. This works as follows: any fields
which are left blank in the PendingIntent template, but are provided by the fillInIntent
will be overwritten, and the resulting PendingIntent will be used. The rest
of the PendingIntent template will then be filled in with the associated fields that are
set in fillInIntent. See Intent#fillIn(Intent, int) for more details.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to set the fillInIntent |
fillInIntent |
Intent: The intent which will be combined with the parent's PendingIntent
in order to determine the on-click behavior of the view specified by viewId |
setOnClickPendingIntent
public void setOnClickPendingIntent (int viewId,
PendingIntent pendingIntent)
Equivalent to calling
View.setOnClickListener(android.view.View.OnClickListener)
to launch the provided PendingIntent. The source bounds
(Intent#getSourceBounds()) of the intent will be set to the bounds of the clicked
view in screen space.
Note that any activity options associated with the mPendingIntent may get overridden
before starting the intent.
When setting the on-click action of items within collections (eg. ListView,
StackView etc.), this method will not work. Instead, use RemoteViews#setPendingIntentTemplate(int, PendingIntent) in conjunction with
RemoteViews#setOnClickFillInIntent(int, Intent).
| Parameters | |
|---|---|
viewId |
int: The id of the view that will trigger the PendingIntent when clicked |
pendingIntent |
PendingIntent: The PendingIntent to send when user clicks |
setOnClickResponse
public void setOnClickResponse (int viewId,
RemoteViews.RemoteResponse response)
Equivalent of calling
View.setOnClickListener(android.view.View.OnClickListener)
to launch the provided RemoteResponse.
| Parameters | |
|---|---|
viewId |
int: The id of the view that will trigger the RemoteResponse when clicked |
response |
RemoteViews.RemoteResponse: The RemoteResponse to send when user clicks
This value cannot be null. |
setPendingIntentTemplate
public void setPendingIntentTemplate (int viewId,
PendingIntent pendingIntentTemplate)
When using collections (eg. ListView, StackView etc.) in widgets, it is very
costly to set PendingIntents on the individual items, and is hence not recommended. Instead
this method should be used to set a single PendingIntent template on the collection, and
individual items can differentiate their on-click behavior using
RemoteViews#setOnClickFillInIntent(int, Intent).
| Parameters | |
|---|---|
viewId |
int: The id of the collection who's children will use this PendingIntent template
when clicked |
pendingIntentTemplate |
PendingIntent: The PendingIntent to be combined with extras specified
by a child of viewId and executed when that child is clicked |
setProgressBar
public void setProgressBar (int viewId,
int max,
int progress,
boolean indeterminate)
Equivalent to calling ProgressBar#setMax,
ProgressBar#setProgress, and
ProgressBar#setIndeterminate
If indeterminate is true, then the values for max and progress are ignored.
| Parameters | |
|---|---|
viewId |
int: The id of the ProgressBar to change |
max |
int: The 100% value for the progress bar |
progress |
int: The current value of the progress bar. |
indeterminate |
boolean: True if the progress bar is indeterminate,
false if not. |
setRelativeScrollPosition
public void setRelativeScrollPosition (int viewId,
int offset)
Equivalent to calling ListView#smoothScrollByOffset(int).
| Parameters | |
|---|---|
viewId |
int: The id of the view to change |
offset |
int: Scroll by this adapter position offset |
setRemoteAdapter
public void setRemoteAdapter (int appWidgetId,
int viewId,
Intent intent)
This method was deprecated
in API level 15.
This method has been deprecated. See
setRemoteAdapter(int, Intent)
Equivalent to calling AbsListView.setRemoteViewsAdapter(Intent).
| Parameters | |
|---|---|
appWidgetId |
int: The id of the app widget which contains the specified view. (This
parameter is ignored in this deprecated method) |
viewId |
int: The id of the AdapterView |
intent |
Intent: The intent of the service which will be
providing data to the RemoteViewsAdapter |
setRemoteAdapter
public void setRemoteAdapter (int viewId,
Intent intent)
Equivalent to calling AbsListView.setRemoteViewsAdapter(Intent).
Can only be used for App Widgets.
| Parameters | |
|---|---|
viewId |
int: The id of the AdapterView |
intent |
Intent: The intent of the service which will be
providing data to the RemoteViewsAdapter |
setScrollPosition
public void setScrollPosition (int viewId,
int position)
Equivalent to calling ListView#smoothScrollToPosition(int).
| Parameters | |
|---|---|
viewId |
int: The id of the view to change |
position |
int: Scroll to this adapter position |
setShort
public void setShort (int viewId,
String methodName,
short value)
Call a method taking one short on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
short: The value to pass to the method. |
setString
public void setString (int viewId,
String methodName,
String value)
Call a method taking one String on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
String: The value to pass to the method. |
setTextColor
public void setTextColor (int viewId,
int color)
Equivalent to calling TextView.setTextColor(int).
| Parameters | |
|---|---|
viewId |
int: The id of the view whose text color should change |
color |
int: Sets the text color for all the states (normal, selected,
focused) to be this color. |
setTextViewCompoundDrawables
public void setTextViewCompoundDrawables (int viewId,
int left,
int top,
int right,
int bottom)
Equivalent to calling
TextView#setCompoundDrawablesWithIntrinsicBounds(int, int, int, int).
| Parameters | |
|---|---|
viewId |
int: The id of the view whose text should change |
left |
int: The id of a drawable to place to the left of the text, or 0 |
top |
int: The id of a drawable to place above the text, or 0 |
right |
int: The id of a drawable to place to the right of the text, or 0 |
bottom |
int: The id of a drawable to place below the text, or 0 |
setTextViewCompoundDrawablesRelative
public void setTextViewCompoundDrawablesRelative (int viewId,
int start,
int top,
int end,
int bottom)
Equivalent to calling TextView#setCompoundDrawablesRelativeWithIntrinsicBounds(int, int, int, int).
| Parameters | |
|---|---|
viewId |
int: The id of the view whose text should change |
start |
int: The id of a drawable to place before the text (relative to the
layout direction), or 0 |
top |
int: The id of a drawable to place above the text, or 0 |
end |
int: The id of a drawable to place after the text, or 0 |
bottom |
int: The id of a drawable to place below the text, or 0 |
setTextViewText
public void setTextViewText (int viewId,
CharSequence text)
Equivalent to calling TextView#setText(CharSequence)
| Parameters | |
|---|---|
viewId |
int: The id of the view whose text should change |
text |
CharSequence: The new text for the view |
setTextViewTextSize
public void setTextViewTextSize (int viewId,
int units,
float size)
Equivalent to calling TextView#setTextSize(int, float)
| Parameters | |
|---|---|
viewId |
int: The id of the view whose text size should change |
units |
int: The units of size (e.g. COMPLEX_UNIT_SP) |
size |
float: The size of the text |
setUri
public void setUri (int viewId,
String methodName,
Uri value)
Call a method taking one Uri on a view in the layout for this RemoteViews.
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call the method. |
methodName |
String: The name of the method to call. |
value |
Uri: The value to pass to the method. |
setViewPadding
public void setViewPadding (int viewId,
int left,
int top,
int right,
int bottom)
Equivalent to calling View.setPadding(int, int, int, int).
| Parameters | |
|---|---|
viewId |
int: The id of the view to change |
left |
int: the left padding in pixels |
top |
int: the top padding in pixels |
right |
int: the right padding in pixels |
bottom |
int: the bottom padding in pixels |
setViewVisibility
public void setViewVisibility (int viewId,
int visibility)
Equivalent to calling View#setVisibility(int)
| Parameters | |
|---|---|
viewId |
int: The id of the view whose visibility should change |
visibility |
int: The new visibility for the view |
showNext
public void showNext (int viewId)
Equivalent to calling AdapterViewAnimator#showNext()
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call AdapterViewAnimator#showNext() |
showPrevious
public void showPrevious (int viewId)
Equivalent to calling AdapterViewAnimator#showPrevious()
| Parameters | |
|---|---|
viewId |
int: The id of the view on which to call AdapterViewAnimator#showPrevious() |
writeToParcel
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel: The Parcel in which the object should be written. |
flags |
int: Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.