lundi 24 avril 2017

Xamarin, Android: How to build an if clause for a certain parameter?

this might seem a little easy but I hope you guys can answer me anyway :)

So, I have this line of code:

    mLocationManager.SetTestProviderEnabled(LocationManager.GpsProvider, true);

Later in my code this appears:

        mLocationManager.RemoveTestProvider(LocationManager.GpsProvider); 

My app will crash, when the TestProvider was NOT enabled and I try to remove it. So I want to build an if clause that would look somehow like this:

if (TestProviderIsEnabled = True) {xxx}

As you can see, this would need to check for the second parameter (the true), and see if it is true or false. Yet I can't seem to put up the correct if clause... Can anybody help me with this? :)

thanks!!!

Aucun commentaire:

Enregistrer un commentaire