In the previous version, the app is terminated when NexacroActivity is terminated. The feature has been supplemented so that more than two NexacroActivities can be managed.
To briefly explain the function, the method of requesting application creation in the Nexacro Platform Form is being used. The following covers 4 topics.
MainActivity.java: NexacroUpdatorActivity derived class settings
ExampleActivity.java: NexacroActivity derived class settings
AndroidManifest.xml: droidManifest.xml settings
Form.xfdl: Calls application from Nexacro Platform Form
MainActivity.java
When writing the MainActivity.java code, which is a NexacroUpdatorActivity derived class, additional interfaces must be written as follows.
Two methods can be used for this: using createInstance or importing and processing with the Resource Manager called from Application.
... @Override public void onCreate(Bundle savedInstanceState) { NexacroResourceManager resourceManager = NexacroResourceManager.createInstance(this); resourceManager.setBootstrapURL("http://[URL]/start_android.json"); resourceManager.setProjectURL("http://[URL]/"); //resourceManager.setContentMode(true); //resourceManager.setFDL("FrameBase::Form_Work.xfdl"); ... }
... @Override public void onCreate(Bundle savedInstanceState) { // naxacro initialization Nexacro nexacro = Nexacro.getInstance(this); if (!nexacro.isInitialized()) nexacro.initialize(); // Application creation NexacroApplication application = nexacro.newApplication(); // Resource Manager settings NexacroResourceManager resourceManager = application.getResourceManager(); resourceManager.setBootstrapURL("http://[URL]/start_android.json"); resourceManager.setProjectURL("http://[URL]/"); //resourceManager.setContentMode(true); //resourceManager.setFDL("FrameBase::Form_Work.xfdl"); ... }
If you want to run a specific form when MainActivity is running, set true in the setContentMode function and designate the form file name in the setFDL function as follows.
public void onCreate(Bundle savedInstanceState) { ... resourceManager.setContentMode(true); resourceManager.setFDL("FrameBase::Form_Work.xfdl"); ...
ExampleActivity.java
The code of ExampleActivity.java, which is a NexacroActivity derived class, can be written follows. The following example uses the system.execBrowser method in the Nexacro Platform form to pass on a specific form name, then receive it to create an application.
public class ExampleActivity extends NexacroActivity { @Override public void onCreate(Bundle savedInstanceState) { // Check the FDL name to be called from the Intent Uri data = getIntent().getData(); String formName = data.getHost(); // Create a nexacro application with the set name (key) createNexacroApplication(formName); // Resource Manager settings NexacroResourceManager resourceManager = getNexacroApplication().getResourceManager(); resourceManager.setBootstrapURL("http://[URL]/start_android.json"); resourceManager.setProjectURL("http://[URL]/"); resourceManager.setContentMode(true); resourceManager.setFDL("FrameBase::" + formName + ".xfdl"); super.onCreate(savedInstanceState); } }
AndroidManifest.xml
In the previous version, only the NexacroUpdatorActivity derived class (nexacro.launcher.MainActivity) was set, but the NexacroActivity derived class (nexacro.launcher.ExampleActivity) can also be set as follows.
... <activity android:name="nexacro.launcher.ExampleActivity" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:configChanges="orientation|keyboardHidden|screenSize"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="nexacro"/> </intent-filter> </activity> ...
Form.xfdl
Nexacro Platform Form uses the system.execBrowser method as follows to pass the form name and allows NexacroActivity to execute a specific form. The schema name "nexacro" is the name set in AndroidManifest.xml.
this.Button01_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo) { system.execBrowser("nexacro://Sample"); };
Since the form executed in NexacroActivity operates as an independent application, executing the exit method terminates only the corresponding activity.
this.Button01_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo) { nexacro.getApplication().exit(); };