Android action automatic run -


i'm asked on xamarin, ask in here too.

so, how can run android activity called redirecti automatically when app launched (without button click)? i'm tried timers, them don't work. maybe i'm coded them wrong.

my code:

public class mainactivity extends appcompatactivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main); }  public void redirecti(view view) {     intent launchintent = getpackagemanager().getlaunchintentforpackage("com.app.package");     if (launchintent != null) {         startactivity(launchintent);     }   } } 

i'm trying redirect app user app (it's com.app.package). i'm using java , android studio. i'm beginner in java , android coding. please me!

best regards

teemu or kuvaaja

thanks @earthw0rmjim comment! i'm solved problem (because understand comment)! code now:

public class mainactivity extends appcompatactivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     intent launchintent = getpackagemanager().getlaunchintentforpackage("com.app.package");     if (launchintent != null) {         startactivity(launchintent);     }     startactivity(launchintent); }  public void redirecti(view view) {     intent launchintent = getpackagemanager().getlaunchintentforpackage("com.app.package");     if (launchintent != null) {         startactivity(launchintent);     } } } 

need redirecti action?


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -