Activity.RequireViewById Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| RequireViewById(Int32) |
Finds a view that was identified by the android:id XML attribute that was processed in onCreate(Bundle), or throws an IllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy. |
| RequireViewById<T>(Int32) |
RequireViewById(Int32)
Finds a view that was identified by the android:id XML attribute that was processed in onCreate(Bundle), or throws an IllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy.
[Android.Runtime.Register("requireViewById", "(I)Landroid/view/View;", "", ApiSince=28)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends android.view.View" })]
public Java.Lang.Object RequireViewById(int id);
[<Android.Runtime.Register("requireViewById", "(I)Landroid/view/View;", "", ApiSince=28)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends android.view.View" })>]
member this.RequireViewById : int -> Java.Lang.Object
Parameters
- id
- Int32
int: the ID to search for
Returns
a view with given ID. This value cannot be null.
- Attributes
Remarks
Finds a view that was identified by the android:id XML attribute that was processed in onCreate(Bundle), or throws an IllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy. Note: In most cases -- depending on compiler support -- the resulting view is automatically cast to the target class type. If the target class type is unconstrained, an explicit cast may be necessary.
See also:
Android reference for android.app.Activity.requireViewById.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
RequireViewById<T>(Int32)
public T RequireViewById<T>(int id) where T : Android.Views.View;
member this.RequireViewById : int -> 'T (requires 'T :> Android.Views.View)
Type Parameters
- T
Parameters
- id
- Int32
Returns
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.