title: Unable to convert instance of type 'Android.Widget.EditText' to type 'Android.Widget.Button'
body: <p>I try to execute the following tutorial :</p>
  
  <pre><code>namespace App1
  {
      [Activity(Label = "App1", MainLauncher = true, Icon = "@drawable/icon")]
      public class MainActivity : Activity
      {
          int count = 1;
  
          protected override void OnCreate(Bundle bundle)
          {
              base.OnCreate(bundle);
  
              // Set our view from the "main" layout resource
              SetContentView(Resource.Layout.Main);
  
              // Get the latitude/longitude EditBox and button resources:
              EditText latitude = FindViewById&lt;EditText&gt;(Resource.Id.latText);
              EditText longitude = FindViewById&lt;EditText&gt;(Resource.Id.longText);
              Button button = FindViewById&lt;Button&gt;(Resource.Id.getWeatherButton);
  
              // When the user clicks the button ...
              button.Click += async (sender, e) =&gt; {
  
                  // Get the latitude and longitude entered by the user and create a query.
                  string url = "http://api.geonames.org/findNearByWeatherJSON?lat=" +
                           latitude.Text +
                           "&amp;lng=" +
                           longitude.Text +
                           "&amp;username=demo";
  
                  // Fetch the weather information asynchronously, 
                  // parse the results, then update the screen:
                  JsonValue json = await FetchWeatherAsync(url);
                  // ParseAndDisplay (json);
              };
          }
  
          // Gets weather data from the passed URL.
          private async Task&lt;JsonValue&gt; FetchWeatherAsync(string url)
          {
              // Create an HTTP web request using the URL:
              HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(url));
              request.ContentType = "application/json";
              request.Method = "GET";
  
              // Send the request to the server and wait for the response:
              using (WebResponse response = await request.GetResponseAsync())
              {
                  // Get a stream representation of the HTTP web response:
                  using (Stream stream = response.GetResponseStream())
                  {
                      // Use this stream to build a JSON document object:
                      JsonValue jsonDoc = await Task.Run(() =&gt; JsonObject.Load(stream));
                      Console.Out.WriteLine("Response: {0}", jsonDoc.ToString());
  
                      // Return the JSON document:
                      return jsonDoc;
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>but when I debug it a pop-up open with the following message : "System.InvalidCastException: Unable to convert instance of type 'Android.Widget.EditText' to type 'Android.Widget.Button'."</p>
  
  <p>I add the main layout code because Xamarin shows me the mistake on Edit Text :</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="10dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="center_horizontal"
      android:id="@+id/latSection"&gt;
      &lt;TextView
          android:text="Enter Latitude:"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="140dp"
          android:layout_height="40dp"
          android:gravity="right"
          android:id="@+id/latLabel" /&gt;
      &lt;EditText
          android:text="47.7"
          android:layout_width="150dp"
          android:layout_height="50dp"
          android:id="@+id/latText"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_marginLeft="5dp" /&gt;
  &lt;/LinearLayout&gt;
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="10dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="center_horizontal"
      android:id="@+id/longSection"&gt;
      &lt;TextView
          android:text="Enter Longitude:"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="140dp"
          android:layout_height="40dp"
          android:gravity="right"
          android:id="@+id/longLabel" /&gt;
      &lt;EditText
          android:text="-122.5"
          android:layout_width="150dp"
          android:layout_height="50dp"
          android:id="@+id/longText"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_marginLeft="5dp" /&gt;
  &lt;/LinearLayout&gt;
  &lt;LinearLayout
      android:orientation="vertical"
      android:layout_marginTop="28dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="center_horizontal"
      android:id="@+id/getSection"&gt;
      &lt;Button
          android:id="@+id/getWeatherButton"
          android:layout_width="300dp"
          android:layout_height="wrap_content"
          android:gravity="center_horizontal"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:text="Get Weather" /&gt;
  &lt;/LinearLayout&gt;
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="30dp"
      android:layout_marginLeft="40dp"
      android:layout_marginRight="40dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/locSection"&gt;
      &lt;TextView
          android:text="Location:"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="120dp"
          android:layout_height="30dp"
          android:gravity="left"
          android:id="@+id/locLabel" /&gt;
      &lt;TextView
          android:text=""
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="wrap_content"
          android:layout_height="60dp"
          android:gravity="left"
          android:id="@+id/locationText" /&gt;
  &lt;/LinearLayout&gt;
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="10dp"
      android:layout_marginLeft="40dp"
      android:layout_marginRight="40dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/tempSection"&gt;
      &lt;TextView
          android:text="Temperature:"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="120dp"
          android:layout_height="30dp"
          android:gravity="left"
          android:id="@+id/tempLabel" /&gt;
      &lt;TextView
          android:text=""
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="wrap_content"
          android:layout_height="30dp"
          android:gravity="left"
          android:id="@+id/tempText" /&gt;
  &lt;/LinearLayout&gt;
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="10dp"
      android:layout_marginLeft="40dp"
      android:layout_marginRight="40dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/humidSection"&gt;
      &lt;TextView
          android:text="Humidity:"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="120dp"
          android:layout_height="30dp"
          android:gravity="left"
          android:id="@+id/humidLabel" /&gt;
      &lt;TextView
          android:text=""
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="wrap_content"
          android:layout_height="30dp"
          android:gravity="left"
          android:id="@+id/humidText" /&gt;
  &lt;/LinearLayout&gt;
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_marginTop="10dp"
      android:layout_marginLeft="40dp"
      android:layout_marginRight="40dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/condSection"&gt;
      &lt;TextView
          android:text="Conditions:"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="120dp"
          android:layout_height="30dp"
          android:gravity="left"
          android:id="@+id/condLabel" /&gt;
      &lt;TextView
          android:text=""
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:layout_width="wrap_content"
          android:layout_height="60dp"
          android:gravity="left"
          android:id="@+id/condText" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks for your help.</p>
  
  <p>----EDIT-----</p>
  
  <p>I finish to resolve my problem .</p>
  
  <pre><code>namespace App1
  {
  [Activity(Label = "App1", MainLauncher = true, Icon = "@drawable/icon")]
  public class MainActivity : Activity
  {
  
      private Button button;
      private EditText latitude;
      private EditText longitude;
  
      protected override void OnCreate(Bundle bundle)
      {
          base.OnCreate(bundle);
  
          // Set our view from the "main" layout resource
          SetContentView(Resource.Layout.Main);
  
          // Get the latitude/longitude EditBox and button resources:
          latitude = FindViewById&lt;EditText&gt;(Resource.Id.latText);
          longitude = FindViewById&lt;EditText&gt;(Resource.Id.longText);
          button = FindViewById&lt;Button&gt;(Resource.Id.getWeatherButton);
  </code></pre>