xamarin android : Executing code before first intent -
in xamarin.android app, need display splash screen image comes http remote server.
so, need execute code (webclient...) before mainlauncher activity displayed (my mainlauncher activity imageview , progressbar).
if add webclient code in mainlauncher activity's oncreate, during download black screen displayed. execute webclient code before mainlauncher displayed.
or kind of trick ok!
hope clear...
you can create class extends android.app.application , add code oncreate method. called before mainlauncher activity on application startup. pointed out here, code invoked when app first loaded.
for example, add application.cs (you can use xamarin studio's new file template android activity) top level of project contents follows:
using system; using system.collections.generic; using system.linq; using system.text; using android.app; using android.content; using android.os; using android.runtime; using android.views; using android.widget; using myapp.core; namespace myapp.droid { public class application : android.app.application { public application(intptr javareference, jnihandleownership transfer) : base(javareference, transfer) { } public override void oncreate() { base.oncreate(); // put setup code here } } }
Comments
Post a Comment