Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
A friend and I are working with some Visual C# 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.
[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, e) =>
SetContentView(Resource.Layout.homeScreen);
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |