Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Image button showing Unhandled exception error.

$
0
0

Hi,

I am new to xamarin android . i am using image button . it is showing "Unhandled exception Error" message. Error Message is

**Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an object. occurred**

My code is:

  <ImageButton
   android:id="@+id/button1"
   android:src="@drawable/testbutton"
   android:layout_width="225dp"
   android:layout_height="225dp"
   android:layout_below="@+id/testbtn"
   android:layout_marginTop="40dp"
   android:background="#dbe8ff"
   android:layout_centerHorizontal="true" />

   ImageButton button2 = FindViewById<ImageButton>(Resource.Id.button1);
   button2.Click += Button2_Click;

Please help me to resolve this.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>