Android: Allow the user to hook into the onCreate methods
onCreate methods are very important when you want to add some java code before the Qt application is loaded. Because onCreate must call "super.onCreate(..)" it is impossible for the user to do anything before Qt is loaded. By using the onCreateHooks to load Qt, the user can decided, by overriding the onCreateHook method, when or if Qt is loaded. Change-Id: I15a3dd60b8ae7d314c53ace99faedfbd47d25502 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
This commit is contained in:
parent
14a5086bd3
commit
1d6eb70dce
@ -258,16 +258,20 @@ public class QtActivity extends Activity
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
protected void onCreateHook(Bundle savedInstanceState) {
|
||||
m_loader.APPLICATION_PARAMETERS = APPLICATION_PARAMETERS;
|
||||
m_loader.ENVIRONMENT_VARIABLES = ENVIRONMENT_VARIABLES;
|
||||
m_loader.QT_ANDROID_THEMES = QT_ANDROID_THEMES;
|
||||
m_loader.QT_ANDROID_DEFAULT_THEME = QT_ANDROID_DEFAULT_THEME;
|
||||
m_loader.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
onCreateHook(savedInstanceState);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
|
@ -50,11 +50,14 @@ public class QtService extends Service
|
||||
/////////////////////////// Super class calls ////////////////////////////////////
|
||||
/////////////// PLEASE DO NOT CHANGE THE FOLLOWING CODE //////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
protected void onCreateHook() {
|
||||
m_loader.onCreate();
|
||||
}
|
||||
@Override
|
||||
public void onCreate()
|
||||
{
|
||||
super.onCreate();
|
||||
m_loader.onCreate();
|
||||
onCreateHook();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user