Added in API level 1

RemoteViews

open class RemoteViews : Parcelable, LayoutInflater.Filter
kotlin.Any
   ↳ 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:

And the following widgets:

As of API 31, the following widgets and layouts may also be used:

Descendants of these classes are not supported.

Summary

Nested classes
open

Exception to send when something goes wrong executing an action

Representation of a fixed list of items to be displayed in a RemoteViews collection.

open

Class representing a response to an action performed on any element of a RemoteViews.

This annotation indicates that a subclass of View is allowed to be used with the RemoteViews mechanism.

OutlineProvider for a view with a radius set by setViewOutlinePreferredRadius(int,float,int).

Constants
static String

The intent extra for whether the view whose checked state changed is currently checked.

static String

The intent extra that contains the bounds for all shared elements.

static Int

The value will apply to the marginBottom.

static Int

The value will apply to the marginEnd.

static Int

The value will apply to the marginLeft.

static Int

The value will apply to the marginRight.

static Int

The value will apply to the marginStart.

static Int

The value will apply to the marginTop.

Inherited constants
Public constructors
RemoteViews(packageName: String!, layoutId: Int)

Create a new RemoteViews object that will display the views contained in the specified layout file.

RemoteViews(packageName: String, layoutId: Int, viewId: Int)

Create a new RemoteViews object that will display the views contained in the specified layout file and change the id of the root view to the specified one.

RemoteViews(landscape: RemoteViews!, portrait: RemoteViews!)

Create a new RemoteViews object that will inflate as the specified landspace or portrait RemoteViews, depending on the current configuration.

Create a new RemoteViews object that will inflate the layout with the closest size specification.

Creates a copy of another RemoteViews.

RemoteViews(parcel: Parcel!)

Reads a RemoteViews object from a parcel.

Public methods
open Unit
addStableView(viewId: Int, nestedView: RemoteViews, stableId: Int)

Equivalent to calling ViewGroup#addView(View) after inflating the given RemoteViews.

open Unit
addView(viewId: Int, nestedView: RemoteViews!)

Equivalent to calling ViewGroup#addView(View) after inflating the given RemoteViews.

open View!
apply(context: Context!, parent: ViewGroup!)

Inflates the view hierarchy represented by this object and applies all of the actions.

open RemoteViews!

Returns a deep copy of the RemoteViews object.

open Int

open Int

Returns the layout id of the root layout associated with this RemoteViews.

open String!

open Int

Get the ID of the top-level view of the XML layout, if set using RemoteViews#RemoteViews(String, int, int).

open Boolean
onLoadClass(clazz: Class<Any!>!)

Used to restrict the views which can be inflated

open Unit
reapply(context: Context!, v: View!)

Applies all of the actions to the provided view.

open Unit

Equivalent to calling ViewGroup#removeAllViews().

open Unit

Equivalent to calling android.view.View#setAccessibilityTraversalAfter(int).

open Unit

Equivalent to calling android.view.View#setAccessibilityTraversalBefore(int).

open Unit
setBitmap(viewId: Int, methodName: String!, value: Bitmap!)

Call a method taking one Bitmap on a view in the layout for this RemoteViews.

open Unit
setBlendMode(viewId: Int, methodName: String, value: BlendMode?)

Call a method taking one BlendMode on a view in the layout for this RemoteViews.

open Unit
setBoolean(viewId: Int, methodName: String!, value: Boolean)

Call a method taking one boolean on a view in the layout for this RemoteViews.

open Unit
setBundle(viewId: Int, methodName: String!, value: Bundle!)

Call a method taking one Bundle on a view in the layout for this RemoteViews.

open Unit
setByte(viewId: Int, methodName: String!, value: Byte)

Call a method taking one byte on a view in the layout for this RemoteViews.

open Unit
setChar(viewId: Int, methodName: String!, value: Char)

Call a method taking one char on a view in the layout for this RemoteViews.

open Unit
setCharSequence(viewId: Int, methodName: String!, value: CharSequence!)

Call a method taking one CharSequence on a view in the layout for this RemoteViews.

open Unit
setCharSequence(viewId: Int, methodName: String, stringResource: Int)

Call a method taking one CharSequence on a view in the layout for this RemoteViews.

open Unit
setCharSequenceAttr(viewId: Int, methodName: String, stringAttribute: Int)

Call a method taking one CharSequence on a view in the layout for this RemoteViews.

open Unit
setChronometer(viewId: Int, base: Long, format: String!, started: Boolean)

Equivalent to calling Chronometer.setBase, Chronometer.setFormat, and Chronometer.start() or Chronometer.stop().

open Unit
setChronometerCountDown(viewId: Int, isCountDown: Boolean)

Equivalent to calling Chronometer.setCountDown on the chronometer with the given viewId.

open Unit
setColor(viewId: Int, methodName: String, colorResource: Int)

Call a method taking one int, a color, on a view in the layout for this RemoteViews.

open Unit
setColorAttr(viewId: Int, methodName: String, colorAttribute: Int)

Call a method taking one int, a color, on a view in the layout for this RemoteViews.

open Unit
setColorInt(viewId: Int, methodName: String, notNight: Int, night: Int)

Call a method taking one int, a color, on a view in the layout for this RemoteViews.

open Unit
setColorStateList(viewId: Int, methodName: String, value: ColorStateList?)

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

open Unit
setColorStateList(viewId: Int, methodName: String, notNight: ColorStateList?, night: ColorStateList?)

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

open Unit
setColorStateList(viewId: Int, methodName: String, colorResource: Int)

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

open Unit
setColorStateListAttr(viewId: Int, methodName: String, colorAttr: Int)

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

open Unit
setCompoundButtonChecked(viewId: Int, checked: Boolean)

Equivalent to calling android.widget.CompoundButton#setChecked(boolean).

open Unit
setContentDescription(viewId: Int, contentDescription: CharSequence!)

Equivalent to calling View.

open Unit
setDisplayedChild(viewId: Int, childIndex: Int)

Equivalent to calling AdapterViewAnimator#setDisplayedChild(int)

open Unit
setDouble(viewId: Int, methodName: String!, value: Double)

Call a method taking one double on a view in the layout for this RemoteViews.

open Unit
setEmptyView(viewId: Int, emptyViewId: Int)

Equivalent to calling AdapterView#setEmptyView(View)

open Unit
setFloat(viewId: Int, methodName: String!, value: Float)

Call a method taking one float on a view in the layout for this RemoteViews.

open Unit
setFloatDimen(viewId: Int, methodName: String, dimenResource: Int)

Call a method taking one float, a size in pixels, on a view in the layout for this RemoteViews.

open Unit
setFloatDimen(viewId: Int, methodName: String, value: Float, unit: Int)

Call a method taking one float, a size in pixels, on a view in the layout for this RemoteViews.

open Unit
setFloatDimenAttr(viewId: Int, methodName: String, dimenAttr: Int)

Call a method taking one float, a size in pixels, on a view in the layout for this RemoteViews.

open Unit
setIcon(viewId: Int, methodName: String!, value: Icon!)

Call a method taking one Icon on a view in the layout for this RemoteViews.

open Unit
setIcon(viewId: Int, methodName: String, notNight: Icon?, night: Icon?)

Call a method taking one Icon on a view in the layout for this RemoteViews.

open Unit
setImageViewBitmap(viewId: Int, bitmap: Bitmap!)

Equivalent to calling ImageView#setImageBitmap(Bitmap)

open Unit
setImageViewIcon(viewId: Int, icon: Icon!)

Equivalent to calling ImageView#setImageIcon(Icon)

open Unit
setImageViewResource(viewId: Int, srcId: Int)

Equivalent to calling ImageView#setImageResource(int)

open Unit
setImageViewUri(viewId: Int, uri: Uri!)

Equivalent to calling ImageView#setImageURI(Uri)

open Unit
setInt(viewId: Int, methodName: String!, value: Int)

Call a method taking one int on a view in the layout for this RemoteViews.

open Unit
setIntDimen(viewId: Int, methodName: String, dimenResource: Int)

Call a method taking one int, a size in pixels, on a view in the layout for this RemoteViews.

open Unit
setIntDimen(viewId: Int, methodName: String, value: Float, unit: Int)

Call a method taking one int, a size in pixels, on a view in the layout for this RemoteViews.

open Unit
setIntDimenAttr(viewId: Int, methodName: String, dimenAttr: Int)

Call a method taking one int, a size in pixels, on a view in the layout for this RemoteViews.

open Unit
setIntent(viewId: Int, methodName: String!, value: Intent!)

Call a method taking one Intent on a view in the layout for this RemoteViews.

open Unit
setLabelFor(viewId: Int, labeledId: Int)

Equivalent to calling View#setLabelFor(int).

open Unit

Provides an alternate layout ID, which can be used to inflate this view.

open Unit
setLong(viewId: Int, methodName: String!, value: Long)

Call a method taking one long on a view in the layout for this RemoteViews.

open Unit

Equivalent to calling android.widget.CompoundButton#setOnCheckedChangeListener( * android.widget.CompoundButton.OnCheckedChangeListener) to launch the provided RemoteResponse.

open Unit
setOnClickFillInIntent(viewId: Int, fillInIntent: Intent!)

When using collections (eg.

open Unit
setOnClickPendingIntent(viewId: Int, pendingIntent: PendingIntent!)

Equivalent to calling android.view.View#setOnClickListener(android.view.View.OnClickListener) to launch the provided PendingIntent.

open Unit

Equivalent of calling android.view.View#setOnClickListener(android.view.View.OnClickListener) to launch the provided RemoteResponse.

open Unit
setPendingIntentTemplate(viewId: Int, pendingIntentTemplate: PendingIntent!)

When using collections (eg.

open Unit
setProgressBar(viewId: Int, max: Int, progress: Int, indeterminate: Boolean)

Equivalent to calling ProgressBar.setMax, android.

open Unit
setRadioGroupChecked(viewId: Int, checkedId: Int)

Equivalent to calling android.widget.RadioGroup#check(int).

open Unit
setRelativeScrollPosition(viewId: Int, offset: Int)

Equivalent to calling ListView#smoothScrollByOffset(int).

open Unit
setRemoteAdapter(appWidgetId: Int, viewId: Int, intent: Intent!)

Equivalent to calling android.widget.AbsListView#setRemoteViewsAdapter(Intent).

open Unit
setRemoteAdapter(viewId: Int, intent: Intent!)

Equivalent to calling android.widget.AbsListView#setRemoteViewsAdapter(Intent).

open Unit

Creates a simple Adapter for the viewId specified.

open Unit
setScrollPosition(viewId: Int, position: Int)

Equivalent to calling ListView#smoothScrollToPosition(int).

open Unit
setShort(viewId: Int, methodName: String!, value: Short)

Call a method taking one short on a view in the layout for this RemoteViews.

open Unit
setString(viewId: Int, methodName: String!, value: String!)

Call a method taking one String on a view in the layout for this RemoteViews.

open Unit
setTextColor(viewId: Int, color: Int)

Equivalent to calling android.widget.TextView#setTextColor(int).

open Unit
setTextViewCompoundDrawables(viewId: Int, left: Int, top: Int, right: Int, bottom: Int)

Equivalent to calling TextView#setCompoundDrawablesWithIntrinsicBounds(int, int, int, int).

open Unit
setTextViewCompoundDrawablesRelative(viewId: Int, start: Int, top: Int, end: Int, bottom: Int)

Equivalent to calling android.widget.TextView#setCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int).

open Unit
setTextViewText(viewId: Int, text: CharSequence!)

Equivalent to calling TextView#setText(CharSequence)

open Unit
setTextViewTextSize(viewId: Int, units: Int, size: Float)

Equivalent to calling TextView#setTextSize(int, float)

open Unit
setUri(viewId: Int, methodName: String!, value: Uri!)

Call a method taking one Uri on a view in the layout for this RemoteViews.

open Unit
setViewLayoutHeight(viewId: Int, height: Float, units: Int)

Equivalent to setting android.view.ViewGroup.LayoutParams#height except that you may provide the value in any dimension units.

open Unit
setViewLayoutHeightAttr(viewId: Int, heightAttr: Int)

Equivalent to setting android.view.ViewGroup.LayoutParams#height with the value of the given attribute in the current theme.

open Unit
setViewLayoutHeightDimen(viewId: Int, heightDimen: Int)

Equivalent to setting android.view.ViewGroup.LayoutParams#height with the result of Resources#getDimensionPixelSize(int).

open Unit
setViewLayoutMargin(viewId: Int, type: Int, value: Float, units: Int)

Equivalent to calling MarginLayoutParams#setMarginEnd.

open Unit
setViewLayoutMarginAttr(viewId: Int, type: Int, attr: Int)

Equivalent to calling MarginLayoutParams#setMarginEnd.

open Unit
setViewLayoutMarginDimen(viewId: Int, type: Int, dimen: Int)

Equivalent to calling MarginLayoutParams#setMarginEnd.

open Unit
setViewLayoutWidth(viewId: Int, width: Float, units: Int)

Equivalent to setting android.view.ViewGroup.LayoutParams#width except that you may provide the value in any dimension units.

open Unit
setViewLayoutWidthAttr(viewId: Int, widthAttr: Int)

Equivalent to setting android.view.ViewGroup.LayoutParams#width with the value of the given attribute in the current theme.

open Unit
setViewLayoutWidthDimen(viewId: Int, widthDimen: Int)

Equivalent to setting android.view.ViewGroup.LayoutParams#width with the result of Resources#getDimensionPixelSize(int).

open Unit
setViewOutlinePreferredRadius(viewId: Int, radius: Float, units: Int)

Sets an OutlineProvider on the view whose corner radius is a dimension calculated using TypedValue#applyDimension(int, float, DisplayMetrics).

open Unit

Sets an OutlineProvider on the view whose corner radius is a dimension attribute with attrId.

open Unit

Sets an OutlineProvider on the view whose corner radius is a dimension resource with resId.

open Unit
setViewPadding(viewId: Int, left: Int, top: Int, right: Int, bottom: Int)

Equivalent to calling android.view.View#setPadding(int, int, int, int).

open Unit
setViewVisibility(viewId: Int, visibility: Int)

Equivalent to calling View#setVisibility(int)

open Unit
showNext(viewId: Int)

Equivalent to calling AdapterViewAnimator#showNext()

open Unit
showPrevious(viewId: Int)

Equivalent to calling AdapterViewAnimator#showPrevious()

open Unit
writeToParcel(dest: Parcel, flags: Int)

Properties
static Parcelable.Creator<RemoteViews!>

Parcelable.

Constants

EXTRA_CHECKED

Added in API level 31
static val EXTRA_CHECKED: String

The intent extra for whether the view whose checked state changed is currently checked.

Value: "android.widget.extra.CHECKED"

EXTRA_SHARED_ELEMENT_BOUNDS

Added in API level 29
static val EXTRA_SHARED_ELEMENT_BOUNDS: String

The intent extra that contains the bounds for all shared elements.

Value: "android.widget.extra.SHARED_ELEMENT_BOUNDS"

MARGIN_BOTTOM

Added in API level 31
static val MARGIN_BOTTOM: Int

The value will apply to the marginBottom.

Value: 3

MARGIN_END

Added in API level 31
static val MARGIN_END: Int

The value will apply to the marginEnd.

Value: 5

MARGIN_LEFT

Added in API level 31
static val MARGIN_LEFT: Int

The value will apply to the marginLeft.

Value: 0

MARGIN_RIGHT

Added in API level 31
static val MARGIN_RIGHT: Int

The value will apply to the marginRight.

Value: 2

MARGIN_START

Added in API level 31
static val MARGIN_START: Int

The value will apply to the marginStart.

Value: 4

MARGIN_TOP

Added in API level 31
static val MARGIN_TOP: Int

The value will apply to the marginTop.

Value: 1

Public constructors

RemoteViews

Added in API level 1
RemoteViews(
    packageName: String!,
    layoutId: Int)

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

Added in API level 1
RemoteViews(
    packageName: String,
    layoutId: Int,
    viewId: Int)

Create a new RemoteViews object that will display the views contained in the specified layout file and change the id of the root view to the specified one.

Parameters
packageName String: Name of the package that contains the layout resource This value cannot be null.
layoutId Int: The id of the layout resource

RemoteViews

Added in API level 1
RemoteViews(
    landscape: RemoteViews!,
    portrait: RemoteViews!)

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
Exceptions
java.lang.IllegalArgumentException if either landscape or portrait are null or if they are not from the same application

RemoteViews

Added in API level 1
RemoteViews(remoteViews: MutableMap<SizeF!, RemoteViews!>)

Create a new RemoteViews object that will inflate the layout with the closest size specification. The default remote views in that case is always the one with the smallest area. If the RemoteViews host provides the size of the view, the layout with the largest area that fits entirely in the provided size will be used (i.e. the width and height of the layout must be less than the size of the view, with a 1dp margin to account for rounding). If no layout fits in the view, the layout with the smallest area will be used.

Parameters
remoteViews MutableMap<SizeF!, RemoteViews!>: Mapping of size to layout. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if the map is empty, there are more than MAX_INIT_VIEW_COUNT layouts or the remote views are not all from the same application.

RemoteViews

Added in API level 1
RemoteViews(src: RemoteViews!)

Creates a copy of another RemoteViews.

RemoteViews

Added in API level 1
RemoteViews(parcel: Parcel!)

Reads a RemoteViews object from a parcel.

Parameters
parcel Parcel!:

Public methods

addStableView

Added in API level 31
open fun addStableView(
    viewId: Int,
    nestedView: RemoteViews,
    stableId: Int
): Unit

Equivalent to calling ViewGroup#addView(View) after inflating the given RemoteViews. If the RemoteViews may be re-inflated or updated, removeAllViews(int) must be called on the same viewId before the first call to this method for the behavior of this method to be predictable. The stableId will be used to identify a potential view to recycled when the remote view is inflated. Views can be re-used if inserted in the same order, potentially with some views appearing / disappearing. To be recycled the view must not change the layout used to inflate it or its view id (see RemoteViews#RemoteViews(String, int, int)). Note: if a view is re-used, all the actions will be re-applied on it. However, its properties are not reset, so what was applied in previous round will have an effect. As a view may be re-created at any time by the host, the RemoteViews should not rely on keeping information from previous applications and always re-set all the properties they need.

Parameters
viewId Int: The id of the parent ViewGroup to add child into.
nestedView RemoteViews: RemoteViews that describes the child. This value cannot be null.
stableId Int: An id that is stable across different versions of RemoteViews.

addView

Added in API level 7
open fun addView(
    viewId: Int,
    nestedView: RemoteViews!
): Unit

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

Added in API level 1
open fun apply(
    context: Context!,
    parent: ViewGroup!
): View!

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.
Return
View! The inflated view hierarchy

clone

Added in API level 1
Deprecated in API level 28
open fun clone(): RemoteViews!

Deprecated: 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.

Return
RemoteViews! a clone of this instance.
Exceptions
java.lang.CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
java.lang.IllegalStateException if this is not the root of a RemoteView hierarchy

describeContents

Added in API level 1
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getLayoutId

Added in API level 1
open fun getLayoutId(): Int

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.

Return
Int the layout id.

getPackage

Added in API level 1
open fun getPackage(): String!

getViewId

Added in API level 31
open fun getViewId(): Int

Get the ID of the top-level view of the XML layout, if set using RemoteViews#RemoteViews(String, int, int).

onLoadClass

Added in API level 1
open fun onLoadClass(clazz: Class<Any!>!): Boolean

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<Any!>!: The class object for the View that is about to be inflated
Return
Boolean True if this class is allowed to be inflated, or false otherwise

reapply

Added in API level 1
open fun reapply(
    context: Context!,
    v: View!
): Unit

Applies all of the actions to the provided view.

Caller beware: this may throw

Parameters
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

Added in API level 7
open fun removeAllViews(viewId: Int): Unit

Equivalent to calling ViewGroup#removeAllViews().

Parameters
viewId Int: The id of the parent ViewGroup to remove all children from.

setAccessibilityTraversalAfter

Added in API level 22
open fun setAccessibilityTraversalAfter(
    viewId: Int,
    nextId: Int
): Unit

Equivalent to calling android.view.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

Added in API level 22
open fun setAccessibilityTraversalBefore(
    viewId: Int,
    nextId: Int
): Unit

Equivalent to calling android.view.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

Added in API level 3
open fun setBitmap(
    viewId: Int,
    methodName: String!,
    value: Bitmap!
): Unit

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.

setBlendMode

Added in API level 31
open fun setBlendMode(
    viewId: Int,
    methodName: String,
    value: BlendMode?
): Unit

Call a method taking one BlendMode 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. This value cannot be null.
value BlendMode?: The value to pass to the method. This value may be null.

setBoolean

Added in API level 3
open fun setBoolean(
    viewId: Int,
    methodName: String!,
    value: Boolean
): Unit

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

Added in API level 8
open fun setBundle(
    viewId: Int,
    methodName: String!,
    value: Bundle!
): Unit

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

Added in API level 3
open fun setByte(
    viewId: Int,
    methodName: String!,
    value: Byte
): Unit

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

Added in API level 3
open fun setChar(
    viewId: Int,
    methodName: String!,
    value: Char
): Unit

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

Added in API level 3
open fun setCharSequence(
    viewId: Int,
    methodName: String!,
    value: CharSequence!
): Unit

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.

setCharSequence

Added in API level 31
open fun setCharSequence(
    viewId: Int,
    methodName: String,
    stringResource: Int
): Unit

Call a method taking one CharSequence on a view in the layout for this RemoteViews. The CharSequence will be resolved from the resources at the time the RemoteViews is (re-)applied. Undefined resources will result in an exception, except 0 which will resolve to null.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
stringResource Int: The resource to resolve and pass as argument to the method.

setCharSequenceAttr

Added in API level 31
open fun setCharSequenceAttr(
    viewId: Int,
    methodName: String,
    stringAttribute: Int
): Unit

Call a method taking one CharSequence on a view in the layout for this RemoteViews. The CharSequence will be resolved from the theme attribute at the time the RemoteViews is (re-)applied. Unresolvable attributes will result in an exception, except 0 which will resolve to null.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
stringAttribute Int: The attribute to resolve and pass as argument to the method.

setChronometer

Added in API level 1
open fun setChronometer(
    viewId: Int,
    base: Long,
    format: String!,
    started: Boolean
): Unit

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.

setChronometerCountDown

Added in API level 24
open fun setChronometerCountDown(
    viewId: Int,
    isCountDown: Boolean
): Unit

Equivalent to calling Chronometer.setCountDown 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.

setColor

Added in API level 31
open fun setColor(
    viewId: Int,
    methodName: String,
    colorResource: Int
): Unit

Call a method taking one int, a color, on a view in the layout for this RemoteViews. The Color will be resolved from the resources at the time the RemoteViews is (re-) applied. Undefined resources will result in an exception, except 0 which will resolve to 0.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
colorResource Int: The resource to resolve and pass as argument to the method.

setColorAttr

Added in API level 31
open fun setColorAttr(
    viewId: Int,
    methodName: String,
    colorAttribute: Int
): Unit

Call a method taking one int, a color, on a view in the layout for this RemoteViews. The Color will be resolved from the theme attribute at the time the RemoteViews is (re-)applied. Unresolvable attributes will result in an exception, except 0 which will resolve to 0.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
colorAttribute Int: The theme attribute to resolve and pass as argument to the method.

setColorInt

Added in API level 31
open fun setColorInt(
    viewId: Int,
    methodName: String,
    notNight: Int,
    night: Int
): Unit

Call a method taking one int, a color, 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. This value cannot be null.
notNight Int: The value to pass to the method when the view's configuration is set to Configuration#UI_MODE_NIGHT_NO
night Int: The value to pass to the method when the view's configuration is set to Configuration#UI_MODE_NIGHT_YES

setColorStateList

Added in API level 31
open fun setColorStateList(
    viewId: Int,
    methodName: String,
    value: ColorStateList?
): Unit

Call a method taking one ColorStateList 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. This value cannot be null.
value ColorStateList?: The value to pass to the method. This value may be null.

setColorStateList

Added in API level 31
open fun setColorStateList(
    viewId: Int,
    methodName: String,
    notNight: ColorStateList?,
    night: ColorStateList?
): Unit

Call a method taking one ColorStateList 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. This value cannot be null.
notNight ColorStateList?: The value to pass to the method when the view's configuration is set to Configuration#UI_MODE_NIGHT_NO This value may be null.
night ColorStateList?: The value to pass to the method when the view's configuration is set to Configuration#UI_MODE_NIGHT_YES This value may be null.

setColorStateList

Added in API level 31
open fun setColorStateList(
    viewId: Int,
    methodName: String,
    colorResource: Int
): Unit

Call a method taking one ColorStateList on a view in the layout for this RemoteViews. The ColorStateList will be resolved from the resources at the time the RemoteViews is (re-)applied. Undefined resources will result in an exception, except 0 which will resolve to null.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
colorResource Int: The resource to resolve and pass as argument to the method.

setColorStateListAttr

Added in API level 31
open fun setColorStateListAttr(
    viewId: Int,
    methodName: String,
    colorAttr: Int
): Unit

Call a method taking one ColorStateList on a view in the layout for this RemoteViews. The ColorStateList will be resolved from the theme attribute at the time the RemoteViews is (re-)applied. Unresolvable attributes will result in an exception, except 0 which will resolve to null.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
colorAttr Int: The theme attribute to resolve and pass as argument to the method.

setCompoundButtonChecked

Added in API level 31
open fun setCompoundButtonChecked(
    viewId: Int,
    checked: Boolean
): Unit

Equivalent to calling android.widget.CompoundButton#setChecked(boolean).

Parameters
viewId Int: The id of the view whose property to set.
checked Boolean: true to check the button, false to uncheck it.

setContentDescription

Added in API level 15
open fun setContentDescription(
    viewId: Int,
    contentDescription: CharSequence!
): Unit

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

Added in API level 12
open fun setDisplayedChild(
    viewId: Int,
    childIndex: Int
): Unit

Equivalent to calling AdapterViewAnimator#setDisplayedChild(int)

Parameters
viewId Int: The id of the view on which to call AdapterViewAnimator#setDisplayedChild(int)

setDouble

Added in API level 3
open fun setDouble(
    viewId: Int,
    methodName: String!,
    value: Double
): Unit

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

Added in API level 11
open fun setEmptyView(
    viewId: Int,
    emptyViewId: Int
): Unit

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

Added in API level 3
open fun setFloat(
    viewId: Int,
    methodName: String!,
    value: Float
): Unit

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.

setFloatDimen

Added in API level 31
open fun setFloatDimen(
    viewId: Int,
    methodName: String,
    dimenResource: Int
): Unit

Call a method taking one float, a size in pixels, on a view in the layout for this RemoteViews. The dimension will be resolved from the resources at the time the RemoteViews is (re-)applied. Undefined resources will result in an exception, except 0 which will resolve to 0f.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
dimenResource Int: The resource to resolve and pass as argument to the method.

setFloatDimen

Added in API level 31
open fun setFloatDimen(
    viewId: Int,
    methodName: String,
    value: Float,
    unit: Int
): Unit

Call a method taking one float, a size in pixels, on a view in the layout for this RemoteViews. The dimension will be resolved from the resources at the time the RemoteViews is (re-)applied.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
value Float: The value of the dimension.
unit Int: The unit in which the value is specified. Value is android.util.TypedValue#COMPLEX_UNIT_PX, android.util.TypedValue#COMPLEX_UNIT_DIP, android.util.TypedValue#COMPLEX_UNIT_SP, android.util.TypedValue#COMPLEX_UNIT_PT, android.util.TypedValue#COMPLEX_UNIT_IN, or android.util.TypedValue#COMPLEX_UNIT_MM

setFloatDimenAttr

Added in API level 31
open fun setFloatDimenAttr(
    viewId: Int,
    methodName: String,
    dimenAttr: Int
): Unit

Call a method taking one float, a size in pixels, on a view in the layout for this RemoteViews. The dimension will be resolved from the theme attribute at the time the RemoteViews is (re-)applied. Unresolvable attributes will result in an exception, except 0 which will resolve to 0f.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
dimenAttr Int: The attribute to resolve and pass as argument to the method.

setIcon

Added in API level 23
open fun setIcon(
    viewId: Int,
    methodName: String!,
    value: Icon!
): Unit

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 android.graphics.drawable.Icon to pass the method.

setIcon

Added in API level 31
open fun setIcon(
    viewId: Int,
    methodName: String,
    notNight: Icon?,
    night: Icon?
): Unit

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. This value cannot be null.
notNight Icon?: The value to pass to the method when the view's configuration is set to Configuration#UI_MODE_NIGHT_NO This value may be null.
night Icon?: The value to pass to the method when the view's configuration is set to Configuration#UI_MODE_NIGHT_YES This value may be null.

setImageViewBitmap

Added in API level 3
open fun setImageViewBitmap(
    viewId: Int,
    bitmap: Bitmap!
): Unit

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

Added in API level 23
open fun setImageViewIcon(
    viewId: Int,
    icon: Icon!
): Unit

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

Added in API level 1
open fun setImageViewResource(
    viewId: Int,
    srcId: Int
): Unit

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

Added in API level 1
open fun setImageViewUri(
    viewId: Int,
    uri: Uri!
): Unit

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

Added in API level 3
open fun setInt(
    viewId: Int,
    methodName: String!,
    value: Int
): Unit

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.

setIntDimen

Added in API level 31
open fun setIntDimen(
    viewId: Int,
    methodName: String,
    dimenResource: Int
): Unit

Call a method taking one int, a size in pixels, on a view in the layout for this RemoteViews. The dimension will be resolved from the resources at the time the RemoteViews is (re-)applied. Undefined resources will result in an exception, except 0 which will resolve to 0.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
dimenResource Int: The resource to resolve and pass as argument to the method.

setIntDimen

Added in API level 31
open fun setIntDimen(
    viewId: Int,
    methodName: String,
    value: Float,
    unit: Int
): Unit

Call a method taking one int, a size in pixels, on a view in the layout for this RemoteViews. The dimension will be resolved from the specified dimension at the time of inflation.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
value Float: The value of the dimension.
unit Int: The unit in which the value is specified. Value is android.util.TypedValue#COMPLEX_UNIT_PX, android.util.TypedValue#COMPLEX_UNIT_DIP, android.util.TypedValue#COMPLEX_UNIT_SP, android.util.TypedValue#COMPLEX_UNIT_PT, android.util.TypedValue#COMPLEX_UNIT_IN, or android.util.TypedValue#COMPLEX_UNIT_MM

setIntDimenAttr

Added in API level 31
open fun setIntDimenAttr(
    viewId: Int,
    methodName: String,
    dimenAttr: Int
): Unit

Call a method taking one int, a size in pixels, on a view in the layout for this RemoteViews. The dimension will be resolved from the theme attribute at the time the RemoteViews is (re-)applied. Unresolvable attributes will result in an exception, except 0 which will resolve to 0.

Parameters
viewId Int: The id of the view on which to call the method.
methodName String: The name of the method to call. This value cannot be null.
dimenAttr Int: The attribute to resolve and pass as argument to the method.

setIntent

Added in API level 11
open fun setIntent(
    viewId: Int,
    methodName: String!,
    value: Intent!
): Unit

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 android.content.Intent to pass the method.

setLabelFor

Added in API level 17
open fun setLabelFor(
    viewId: Int,
    labeledId: Int
): Unit

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

Added in API level 29
open fun setLightBackgroundLayoutId(layoutId: Int): Unit

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.

setLong

Added in API level 3
open fun setLong(
    viewId: Int,
    methodName: String!,
    value: Long
): Unit

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.

setOnCheckedChangeResponse

Added in API level 31
open fun setOnCheckedChangeResponse(
    viewId: Int,
    response: RemoteViews.RemoteResponse
): Unit

Equivalent to calling android.widget.CompoundButton#setOnCheckedChangeListener( * android.widget.CompoundButton.OnCheckedChangeListener) to launch the provided RemoteResponse. The intent will be filled with the current checked state of the view at the key EXTRA_CHECKED. The RemoteResponse will not be launched in response to check changes arising from setCompoundButtonChecked(int,boolean) or setRadioGroupChecked(int,int) usages. The RemoteResponse must be created using RemoteResponse#fromFillInIntent(Intent) in conjunction with RemoteViews#setPendingIntentTemplate(int, PendingIntent) for items inside collections (eg. ListView, StackView etc.). Otherwise, create the RemoteResponse using RemoteResponse#fromPendingIntent(PendingIntent).

Parameters
viewId Int: The id of the view that will trigger the PendingIntent when checked state changes.
response RemoteViews.RemoteResponse: The RemoteResponse to send when the checked state changes. This value cannot be null.

setOnClickFillInIntent

Added in API level 11
open fun setOnClickFillInIntent(
    viewId: Int,
    fillInIntent: Intent!
): Unit

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 android.widget.RemoteViews#setPendingIntentTemplate(int,android.app.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

Added in API level 3
open fun setOnClickPendingIntent(
    viewId: Int,
    pendingIntent: PendingIntent!
): Unit

Equivalent to calling android.view.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 android.widget.RemoteViews#setPendingIntentTemplate(int,android.app.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

Added in API level 29
open fun setOnClickResponse(
    viewId: Int,
    response: RemoteViews.RemoteResponse
): Unit

Equivalent of calling android.view.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

Added in API level 11
open fun setPendingIntentTemplate(
    viewId: Int,
    pendingIntentTemplate: PendingIntent!
): Unit

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

Added in API level 1
open fun setProgressBar(
    viewId: Int,
    max: Int,
    progress: Int,
    indeterminate: Boolean
): Unit

Equivalent to calling ProgressBar.setMax, android.widget.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.

setRadioGroupChecked

Added in API level 31
open fun setRadioGroupChecked(
    viewId: Int,
    checkedId: Int
): Unit

Equivalent to calling android.widget.RadioGroup#check(int).

Parameters
viewId Int: The id of the view whose property to set.
checkedId Int: The unique id of the radio button to select in the group.

setRelativeScrollPosition

Added in API level 11
open fun setRelativeScrollPosition(
    viewId: Int,
    offset: Int
): Unit

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

Added in API level 11
Deprecated in API level 15
open fun setRemoteAdapter(
    appWidgetId: Int,
    viewId: Int,
    intent: Intent!
): Unit

Deprecated: This method has been deprecated. See android.widget.RemoteViews#setRemoteAdapter(int, Intent)

Equivalent to calling android.widget.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

open fun setRemoteAdapter(
    viewId: Int,
    intent: Intent!
): Unit

Deprecated: use setRemoteAdapter(int,android.widget.RemoteViews.RemoteCollectionItems) instead

Equivalent to calling android.widget.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

setRemoteAdapter

Added in API level 31
open fun setRemoteAdapter(
    viewId: Int,
    items: RemoteViews.RemoteCollectionItems
): Unit

Creates a simple Adapter for the viewId specified. The viewId must point to an AdapterView, ie. ListView, GridView, StackView or AdapterViewAnimator. This is a simpler but less flexible approach to populating collection widgets. Its use is encouraged for most scenarios, as long as the total memory within the list of RemoteViews is relatively small (ie. doesn't contain large or numerous Bitmaps, see android.widget.RemoteViews#setImageViewBitmap). In the case of numerous images, the use of API is still possible by setting image URIs instead of Bitmaps, see RemoteViews#setImageViewUri. This API is supported in the compatibility library for previous API levels, see RemoteViewsCompat.

Parameters
viewId Int: The id of the AdapterView.
items RemoteViews.RemoteCollectionItems: The items to display in the AdapterView. This value cannot be null.

setScrollPosition

Added in API level 11
open fun setScrollPosition(
    viewId: Int,
    position: Int
): Unit

Equivalent to calling ListView#smoothScrollToPosition(int).

Parameters
viewId Int: The id of the view to change
position Int: Scroll to this adapter position

setShort

Added in API level 3
open fun setShort(
    viewId: Int,
    methodName: String!,
    value: Short
): Unit

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

Added in API level 3
open fun setString(
    viewId: Int,
    methodName: String!,
    value: String!
): Unit

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

Added in API level 3
open fun setTextColor(
    viewId: Int,
    color: Int
): Unit

Equivalent to calling android.widget.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

Added in API level 16
open fun setTextViewCompoundDrawables(
    viewId: Int,
    left: Int,
    top: Int,
    right: Int,
    bottom: Int
): Unit

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

Added in API level 16
open fun setTextViewCompoundDrawablesRelative(
    viewId: Int,
    start: Int,
    top: Int,
    end: Int,
    bottom: Int
): Unit

Equivalent to calling android.widget.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

Added in API level 1
open fun setTextViewText(
    viewId: Int,
    text: CharSequence!
): Unit

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

Added in API level 16
open fun setTextViewTextSize(
    viewId: Int,
    units: Int,
    size: Float
): Unit

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

Added in API level 3
open fun setUri(
    viewId: Int,
    methodName: String!,
    value: Uri!
): Unit

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.

setViewLayoutHeight

Added in API level 31
open fun setViewLayoutHeight(
    viewId: Int,
    height: Float,
    units: Int
): Unit

Equivalent to setting android.view.ViewGroup.LayoutParams#height except that you may provide the value in any dimension units.

NOTE: It is recommended to use TypedValue#COMPLEX_UNIT_PX only for 0, ViewGroup.LayoutParams#WRAP_CONTENT, or ViewGroup.LayoutParams#MATCH_PARENT. Setting actual sizes in pixels will behave poorly when the RemoteViews object is used on a display with a different density.

Parameters
height Float: height of the view in the given units
units Int: The unit type of the value e.g. TypedValue#COMPLEX_UNIT_DIP Value is android.util.TypedValue#COMPLEX_UNIT_PX, android.util.TypedValue#COMPLEX_UNIT_DIP, android.util.TypedValue#COMPLEX_UNIT_SP, android.util.TypedValue#COMPLEX_UNIT_PT, android.util.TypedValue#COMPLEX_UNIT_IN, or android.util.TypedValue#COMPLEX_UNIT_MM

setViewLayoutHeightAttr

Added in API level 31
open fun setViewLayoutHeightAttr(
    viewId: Int,
    heightAttr: Int
): Unit

Equivalent to setting android.view.ViewGroup.LayoutParams#height with the value of the given attribute in the current theme.

Parameters
heightAttr Int: a dimen attribute to read the height from.

setViewLayoutHeightDimen

Added in API level 31
open fun setViewLayoutHeightDimen(
    viewId: Int,
    heightDimen: Int
): Unit

Equivalent to setting android.view.ViewGroup.LayoutParams#height with the result of Resources#getDimensionPixelSize(int).

Parameters
heightDimen Int: a dimen resource to read the height from.

setViewLayoutMargin

Added in API level 31
open fun setViewLayoutMargin(
    viewId: Int,
    type: Int,
    value: Float,
    units: Int
): Unit

Equivalent to calling MarginLayoutParams#setMarginEnd. Only works if the View#getLayoutParams() supports margins.

NOTE: It is recommended to use TypedValue#COMPLEX_UNIT_PX only for 0. Setting margins in pixels will behave poorly when the RemoteViews object is used on a display with a different density.

Parameters
viewId Int: The id of the view to change
type Int: The margin being set e.g. MARGIN_END Value is android.widget.RemoteViews#MARGIN_LEFT, android.widget.RemoteViews#MARGIN_TOP, android.widget.RemoteViews#MARGIN_RIGHT, android.widget.RemoteViews#MARGIN_BOTTOM, android.widget.RemoteViews#MARGIN_START, or android.widget.RemoteViews#MARGIN_END
value Float: a value for the margin the given units.
units Int: The unit type of the value e.g. TypedValue#COMPLEX_UNIT_DIP Value is android.util.TypedValue#COMPLEX_UNIT_PX, android.util.TypedValue#COMPLEX_UNIT_DIP, android.util.TypedValue#COMPLEX_UNIT_SP, android.util.TypedValue#COMPLEX_UNIT_PT, android.util.TypedValue#COMPLEX_UNIT_IN, or android.util.TypedValue#COMPLEX_UNIT_MM

setViewLayoutMarginAttr

Added in API level 31
open fun setViewLayoutMarginAttr(
    viewId: Int,
    type: Int,
    attr: Int
): Unit

Equivalent to calling MarginLayoutParams#setMarginEnd. Only works if the View#getLayoutParams() supports margins.

Parameters
viewId Int: The id of the view to change
type Int: The margin being set e.g. MARGIN_END Value is android.widget.RemoteViews#MARGIN_LEFT, android.widget.RemoteViews#MARGIN_TOP, android.widget.RemoteViews#MARGIN_RIGHT, android.widget.RemoteViews#MARGIN_BOTTOM, android.widget.RemoteViews#MARGIN_START, or android.widget.RemoteViews#MARGIN_END
attr Int: a dimension attribute to apply to the margin, or 0 to clear the margin.

setViewLayoutMarginDimen

Added in API level 31
open fun setViewLayoutMarginDimen(
    viewId: Int,
    type: Int,
    dimen: Int
): Unit

Equivalent to calling MarginLayoutParams#setMarginEnd. Only works if the View#getLayoutParams() supports margins.

Parameters
viewId Int: The id of the view to change
type Int: The margin being set e.g. MARGIN_END Value is android.widget.RemoteViews#MARGIN_LEFT, android.widget.RemoteViews#MARGIN_TOP, android.widget.RemoteViews#MARGIN_RIGHT, android.widget.RemoteViews#MARGIN_BOTTOM, android.widget.RemoteViews#MARGIN_START, or android.widget.RemoteViews#MARGIN_END
dimen Int: a dimension resource to apply to the margin, or 0 to clear the margin.

setViewLayoutWidth

Added in API level 31
open fun setViewLayoutWidth(
    viewId: Int,
    width: Float,
    units: Int
): Unit

Equivalent to setting android.view.ViewGroup.LayoutParams#width except that you may provide the value in any dimension units.

NOTE: It is recommended to use TypedValue#COMPLEX_UNIT_PX only for 0, ViewGroup.LayoutParams#WRAP_CONTENT, or ViewGroup.LayoutParams#MATCH_PARENT. Setting actual sizes in pixels will behave poorly when the RemoteViews object is used on a display with a different density.

Parameters
width Float: Width of the view in the given units
units Int: The unit type of the value e.g. TypedValue#COMPLEX_UNIT_DIP Value is android.util.TypedValue#COMPLEX_UNIT_PX, android.util.TypedValue#COMPLEX_UNIT_DIP, android.util.TypedValue#COMPLEX_UNIT_SP, android.util.TypedValue#COMPLEX_UNIT_PT, android.util.TypedValue#COMPLEX_UNIT_IN, or android.util.TypedValue#COMPLEX_UNIT_MM

setViewLayoutWidthAttr

Added in API level 31
open fun setViewLayoutWidthAttr(
    viewId: Int,
    widthAttr: Int
): Unit

Equivalent to setting android.view.ViewGroup.LayoutParams#width with the value of the given attribute in the current theme.

Parameters
widthAttr Int: the dimension attribute for the view's width

setViewLayoutWidthDimen

Added in API level 31
open fun setViewLayoutWidthDimen(
    viewId: Int,
    widthDimen: Int
): Unit

Equivalent to setting android.view.ViewGroup.LayoutParams#width with the result of Resources#getDimensionPixelSize(int).

Parameters
widthDimen Int: the dimension resource for the view's width

setViewOutlinePreferredRadius

Added in API level 31
open fun setViewOutlinePreferredRadius(
    viewId: Int,
    radius: Float,
    units: Int
): Unit

Sets an OutlineProvider on the view whose corner radius is a dimension calculated using TypedValue#applyDimension(int, float, DisplayMetrics).

NOTE: It is recommended to use TypedValue#COMPLEX_UNIT_PX only for 0. Setting margins in pixels will behave poorly when the RemoteViews object is used on a display with a different density.

Parameters
units Int: Value is android.util.TypedValue#COMPLEX_UNIT_PX, android.util.TypedValue#COMPLEX_UNIT_DIP, android.util.TypedValue#COMPLEX_UNIT_SP, android.util.TypedValue#COMPLEX_UNIT_PT, android.util.TypedValue#COMPLEX_UNIT_IN, or android.util.TypedValue#COMPLEX_UNIT_MM

setViewOutlinePreferredRadiusAttr

Added in API level 31
open fun setViewOutlinePreferredRadiusAttr(
    viewId: Int,
    attrId: Int
): Unit

Sets an OutlineProvider on the view whose corner radius is a dimension attribute with attrId.

setViewOutlinePreferredRadiusDimen

Added in API level 31
open fun setViewOutlinePreferredRadiusDimen(
    viewId: Int,
    resId: Int
): Unit

Sets an OutlineProvider on the view whose corner radius is a dimension resource with resId.

setViewPadding

Added in API level 16
open fun setViewPadding(
    viewId: Int,
    left: Int,
    top: Int,
    right: Int,
    bottom: Int
): Unit

Equivalent to calling android.view.View#setPadding(int, int, int, int).

Parameters
viewId Int: The id of the view to change
left Int: the left padding in pixels This units of this value are pixels.
top Int: the top padding in pixels This units of this value are pixels.
right Int: the right padding in pixels This units of this value are pixels.
bottom Int: the bottom padding in pixels This units of this value are pixels.

setViewVisibility

Added in API level 1
open fun setViewVisibility(
    viewId: Int,
    visibility: Int
): Unit

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 Value is android.view.View#VISIBLE, android.view.View#INVISIBLE, or android.view.View#GONE

showNext

Added in API level 11
Deprecated in API level 33
open fun showNext(viewId: Int): Unit

Deprecated: As RemoteViews may be reapplied frequently, it is preferable to call setDisplayedChild(int,int) to ensure that the adapter index does not change unexpectedly.

Equivalent to calling AdapterViewAnimator#showNext()

Parameters
viewId Int: The id of the view on which to call AdapterViewAnimator#showNext()

showPrevious

Added in API level 11
Deprecated in API level 33
open fun showPrevious(viewId: Int): Unit

Deprecated: As RemoteViews may be reapplied frequently, it is preferable to call setDisplayedChild(int,int) to ensure that the adapter index does not change unexpectedly.

Equivalent to calling AdapterViewAnimator#showPrevious()

Parameters
viewId Int: The id of the view on which to call AdapterViewAnimator#showPrevious()

writeToParcel

Added in API level 1
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit
Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 1
static val CREATOR: Parcelable.Creator<RemoteViews!>

Parcelable.Creator that instantiates RemoteViews objects