A airblaster Active Member Licensed User Longtime User Mar 21, 2013 #1 B4X: Activity.Finish Dim r, r2 As Reflector r.Target = r.GetActivity r.Target = r.RunMethod("getApplicationContext") r2.Target = r.RunMethod("getPackageManager") Dim i As Intent = r2.RunMethod2("getLaunchIntentForPackage", r.RunMethod("getPackageName"), "java.lang.String" ) r.Target = i r.RunMethod2("addFlags", 67108864, "java.lang.int") StartActivity(i)
B4X: Activity.Finish Dim r, r2 As Reflector r.Target = r.GetActivity r.Target = r.RunMethod("getApplicationContext") r2.Target = r.RunMethod("getPackageManager") Dim i As Intent = r2.RunMethod2("getLaunchIntentForPackage", r.RunMethod("getPackageName"), "java.lang.String" ) r.Target = i r.RunMethod2("addFlags", 67108864, "java.lang.int") StartActivity(i)
EduardoElias Well-Known Member Licensed User Longtime User Jun 12, 2013 #2 airblaster said: B4X: Activity.Finish Dim r, r2 As Reflector r.Target = r.GetActivity r.Target = r.RunMethod("getApplicationContext") r2.Target = r.RunMethod("getPackageManager") Dim i As Intent = r2.RunMethod2("getLaunchIntentForPackage", r.RunMethod("getPackageName"), "java.lang.String" ) r.Target = i r.RunMethod2("addFlags", 67108864, "java.lang.int") StartActivity(i) Click to expand... Hi there, is it possible to give an example of use of you code? I have an app that load configuration from a server, and if the configuration is changed i need to restart to draw the views in the new style. Thanks Eduardo Upvote 0
airblaster said: B4X: Activity.Finish Dim r, r2 As Reflector r.Target = r.GetActivity r.Target = r.RunMethod("getApplicationContext") r2.Target = r.RunMethod("getPackageManager") Dim i As Intent = r2.RunMethod2("getLaunchIntentForPackage", r.RunMethod("getPackageName"), "java.lang.String" ) r.Target = i r.RunMethod2("addFlags", 67108864, "java.lang.int") StartActivity(i) Click to expand... Hi there, is it possible to give an example of use of you code? I have an app that load configuration from a server, and if the configuration is changed i need to restart to draw the views in the new style. Thanks Eduardo
Erel B4X founder Staff member Licensed User Longtime User Jun 12, 2013 #3 You can restart the current activity with these two lines: B4X: Activity.Finish StartActivity(Me) Upvote 0
A airblaster Active Member Licensed User Longtime User Jun 13, 2013 #4 lol, I didn't know it could be done this way too Upvote 0
EduardoElias Well-Known Member Licensed User Longtime User Jun 13, 2013 #5 Erel said: You can restart the current activity with these two lines: B4X: Activity.Finish StartActivity(Me) Click to expand... Sorry the obvious question, however I am not sure how to use it. I have added these 2 lines on my code, the app is finished but does not get started back again. What else is needed? Thanks Upvote 0
Erel said: You can restart the current activity with these two lines: B4X: Activity.Finish StartActivity(Me) Click to expand... Sorry the obvious question, however I am not sure how to use it. I have added these 2 lines on my code, the app is finished but does not get started back again. What else is needed? Thanks
A airblaster Active Member Licensed User Longtime User Jun 13, 2013 #6 Hi eelias, you could also try adding my code above at the place you want to initiate the restart. Upvote 0
udg Expert Licensed User Longtime User Jan 8, 2014 #7 Hi all, I'm developing a library to automate app updating. It would be nice to add some code capable of restarting the update version of the running app. How have I to modify (if any) your code for that? And where should I put it? TIA Umberto Upvote 0
Hi all, I'm developing a library to automate app updating. It would be nice to add some code capable of restarting the update version of the running app. How have I to modify (if any) your code for that? And where should I put it? TIA Umberto
E emockler Member Licensed User Longtime User Sep 6, 2015 #8 airblaster said: Hi eelias, you could also try adding my code above at the place you want to initiate the restart. Click to expand... I did & it works. Thanks! Upvote 0
airblaster said: Hi eelias, you could also try adding my code above at the place you want to initiate the restart. Click to expand... I did & it works. Thanks!