xamarin - Android.App.Application class being set to null -
i coding xamarin application, , have questions in regards using android.app.application
class.
android.app.application
class can reset null? when/why happen? how can application perform occurrence can test eventuality? will next code sufficient in case happen?
public class myapplication : android.app.application { public static webservicedata1_0 webservicedata; public static void setupobjects() { webservicedata = new webservicedata1_0(); } public static webservicedata1_0 getwebservicedata() { if (webservicedata == null) { webservicedata = new webservicedata1_0(); } homecoming webservicedata; } }
in above code, each time wish utilize webservicedata1_0
object, should utilize getwebservicedata()
function.
thanks in advance
sort of. when application instance destroyed means os removed entire application , next time user clicks on (or otherwise starts it) created again.
se above.
just create sure initialize stuff when application starts (perhaps overriding application.oncreate) , consider lazy deferred initialization if takes time.
null xamarin android
No comments:
Post a Comment