Android: add call QtActivity.appendApplicationParameters() to set args
Instead of having to set a field of the class QtActivity to set extra app parameters (i.e. passed when calling main()), make it doable via a new API call appendApplicationParameters(). Note that this is equivalent to setting the manifest metadata "android.app.arguments". Providing a dedicated method for this makes it cleaner and is the expected way. Task-number: QTBUG-115017 Task-number: QTBUG-114593 Change-Id: I407cb68e57fa9a1be24586e42cb947f9c7f4037e Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
This commit is contained in:
parent
2f706df651
commit
f6ad69506a
@ -21,13 +21,7 @@ import android.view.Window;
|
||||
|
||||
public class QtActivityBase extends Activity
|
||||
{
|
||||
private boolean m_optionsMenuIsVisible = false;
|
||||
|
||||
// use this variable to pass any parameters to your application,
|
||||
// the parameters must not contain any white spaces
|
||||
// and must be separated with "\t"
|
||||
// e.g "-param1\t-param2=value2\t-param3\tvalue3"
|
||||
public String APPLICATION_PARAMETERS = null;
|
||||
public String m_applicationParams = null;
|
||||
|
||||
// use this variable to add any environment variables to your application.
|
||||
// the env vars must be separated with "\t"
|
||||
@ -62,6 +56,13 @@ public class QtActivityBase extends Activity
|
||||
intent.putExtra(extraSourceInfoKey, sourceInformation);
|
||||
}
|
||||
|
||||
// Append any parameters to your application,
|
||||
// the parameters must be "\t" separated.
|
||||
protected void appendApplicationParameters(String params)
|
||||
{
|
||||
m_applicationParams += params;
|
||||
}
|
||||
|
||||
private void handleActivityRestart() {
|
||||
if (QtNative.isStarted()) {
|
||||
boolean updated = m_delegate.updateActivityAfterRestart(this);
|
||||
@ -99,7 +100,7 @@ public class QtActivityBase extends Activity
|
||||
addReferrer(getIntent());
|
||||
|
||||
QtActivityLoader loader = new QtActivityLoader(this);
|
||||
loader.setApplicationParameters(APPLICATION_PARAMETERS);
|
||||
loader.setApplicationParameters(m_applicationParams);
|
||||
loader.setEnvironmentVariables(ENVIRONMENT_VARIABLES);
|
||||
|
||||
loader.loadQtLibraries();
|
||||
|
@ -19,12 +19,6 @@ public class QtActivity extends QtActivityBase
|
||||
|
||||
private void setAppDetails()
|
||||
{
|
||||
// use this variable to pass any parameters to your application,
|
||||
// the parameters must not contain any white spaces
|
||||
// and must be separated with "\t"
|
||||
// e.g "-param1\t-param2=value2\t-param3\tvalue3"
|
||||
APPLICATION_PARAMETERS = "";
|
||||
|
||||
// Use this variable to add any environment variables to your application.
|
||||
// the env vars must be separated with "\t"
|
||||
// e.g. "ENV_VAR1=1\tENV_VAR2=2\t"
|
||||
|
Loading…
Reference in New Issue
Block a user