Android Question java _onCreate hook

Massimiliano

Member
Licensed User
Longtime User
Hello,
I need to read saved map data file inside the _onCreate hook (Main activity).

B4X:
#if java
public void _onCreate() {
    // I need here to get a map key
    ....
}
#end if

Any hint?
Massimiliano
 

Massimiliano

Member
Licensed User
Longtime User
I'm trying to change theme at runtime as this old thread
https://www.b4x.com/android/forum/threads/changing-the-theme-at-runtime.57277/
I've defined some custom styles inside my manifest

public void _onCreate() {
if (_theme_value != 0)
setTheme(_theme_value);
}

However inside the main activity (firsttime load) I'm unable to get the StyleID stored inside the map file
I've tried to declare theme_value anywere (inside main, globals and also in the starter service), but it seems that the onCreate is fired before I can assign a value to theme_value (map.get("styleID")).

Rotating the main activity - so it reloads - the styleid it's applied correcly

Also calling
B4X:
Activity.Finish
StartActivity(Me)
when firstime=true only works on some devices on other devices activity finish but doesn't restart

I've read @jonedon solution on post #14, but it'always return me StyleID 0. So probably I'm loosing something inside the java code :(

Massimiliano
 
Upvote 0
Top