cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Centurion041 Frequent Visitor
Frequent Visitor

NullReferenceException Help

I'm working with a friend on some code and we keep getting the message "System.NullReferenceException: Object reference not set to an instance of an object." How do we fix it? The code is attached. We are using Visual C#.

[Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)]
    public class MainActivity : AppCompatActivity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.homeScreen);
            Button findAirport = FindViewById<Button>(Resource.Id.findAirport);
            Button findPrevious = FindViewById<Button>(Resource.Id.findPrevious);
            Button goHome = FindViewById<Button>(Resource.Id.homeButton);
            findAirport.Click+= (button, e) =>
            SetContentView(Resource.Layout.findNew);
            findPrevious.Click += (button, e) =>
            SetContentView(Resource.Layout.loadPrevious);
            goHome.Click += (button, b) =>
            SetContentView(Resource.Layout.homeScreen);

 

1 REPLY 1
Super User
Super User

Re: NullReferenceException Help

@Centurion041 not sure if this is the right forum for your question.






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 282 members 3,059 guests
Please welcome our newest community members: