I'm new in mobile app development. I'm using Xamarin to develop Android applications. In the hello world app in the OnCreate method I see the following code:

```
Button button = FindViewById<Button>(Resource.Id.MyButton);

```

So I'm trying to create my own button the same way. I create the button in the designer and inside OnCreate method put the line:

```
Button myOwnBtn = FindViewById<Button>(Resource.Id.MyOwnBtn);

```

That gives me an error that there is no MyOwnBtn. Then I'm looking the code of Id class and see there a line like:

```
public const int MyButton=2123344112;

```

If I put there the line:

```
public const int MyOwnBtn=2123344113;

```

Everything works fine. But as I understand it should be generated automatically or it will be a little bit difficult to put there a unique number for each control.

Can anybody tell me what I am doing wrong? And how does FindViewById() work?
['https://Stackoverflow.com/questions/25278612', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3484533/']
You have to give the `id` `MyOwnBtn` to the `Button` that you created in the designer.

`findViewById` is a method of the `View` class and it looks for a child view having the `id` that you provided in the argument.

From [official documentation](http://developer.android.com/reference/android/view/View.html#findViewById(int)):

> 
> Look for a child view with the given id. If this view has the given id, return this view.
> 
> 
>
MyButton id is not a const value, It will change every launch.