Join us for ⁠#Android11: The Beta Launch Show on June 3!
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:

Descendants of these classes are not supported.

Summary

Nested classes

open

Exception to send when something goes wrong executing an action

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.

Constants

static String

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

Inherited constants

Public constructors

<init>(packageName: String!, layoutId: Int)

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

<init>(landscape: RemoteViews!, portrait: RemoteViews!)

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

Creates a copy of another RemoteViews.

<init>(parcel: Parcel!)

Reads a RemoteViews object from a parcel.

Public methods

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 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
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
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(boolean) on the chronometer with the given viewId.

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
setIcon(viewId: Int, methodName: String!, value: 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
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
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, ProgressBar#setProgress, and ProgressBar#setIndeterminate If indeterminate is true, then the values for max and progress are ignored.

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
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 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
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_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"

Public constructors

<init>

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

<init>

Added in API level 16
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

<init>

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

Creates a copy of another RemoteViews.

<init>

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

Reads a RemoteViews object from a parcel.

Parameters
parcel Parcel!:

Public methods

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!

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

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. * @apiSince 22

setAccessibilityTraversalBefore

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. * @apiSince 22

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.

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.

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(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

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.

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.

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.

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.

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 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

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 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

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, 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

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

Added in API level 14
open fun setRemoteAdapter(
    viewId: Int,
    intent: Intent!
): Unit

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

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

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
top Int: the top padding in pixels
right Int: the right padding in pixels
bottom Int: the bottom padding in 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

showNext

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

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
open fun showPrevious(viewId: Int): Unit

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