Enabling Dual Window

To convert an application into the Dual window application, namely to run an application in the Split window, you should modify the application's AndroidManifest.xml using the Dual window meta-data.

 

You don’t need to use specific APIs to convert an existing application to the Dual window application. You can do it by simply adding 2~3 line codes on the AndroidManifest.xml.

 

If the manifest file has the metadata for Dual window, the application’s execution icon will be included in Dual window App Drawer. By choosing the execution icon in the app drawer, users can run the application in the Split window. In each Split window, the Dual window automatically adjusts the height of the application’s activities and creates a scroll bar.

There are two type of metadata. One is for the application level and the other is for the activity level.

Application level <meta-data>

First, add the following <meta-data> in the <application> element to allow your application to run as a Split window.

 

(AndroidManifest.xml)

<application
<meta-data android:name="com.lge.support.SPLIT_WINDOW"
android:value="true"/>
<activity
... </activity>
</application>

 

1. This <meta-data> should be defined between <application> and </application>.
2. If this <meta-data> is added, all activities in the application are allowed to work with Split window by default.
3. The activity that has the category.LAUNCHER is shown in the Dual window App Drawer, allowing users to run the application as a Split window.

Activity Level <meta-data>

You can enable/disable the Split window for individual activities using the following metadata in the <activity> element:

 

(AndroidManifest.xml)

 <application
<meta-data android:name="com.lge.support.SPLIT_WINDOW"
android:value="true"/>
...
<activity
android:name=".Activity2"
android:label="@string/Activity2" >
<meta-data
android:name="com.lge.support.SPLIT_WINDOW.SUPPORT_SPLIT" android:value="false"/>
</activity>
...
</application>

 

1. This <meta-data> should be defined between <activity> and </activity>.
2. If you don't want to run the activity as the Split window, set it as "false" in the <meta-data>.
3. You should also add the <meta-data> for the application.

Example of <meta-data> declaration

Refer the following example:

 

(AndroidManifest.xml)

 <application
<meta-data android:name="com.lge.support.SPLIT_WINDOW" ①
android:value="true"/>
<activity ②
android:name=".Activity1"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="com.lge.support.SPLIT_WINDOW.SUPPORT_SPLIT" ③
android:value="true"/>
</activity>

<activity
android:name=".Activity2"
android:label="@string/Activity2" >
<meta-data ④
android:name="com.lge.support.SPLIT_WINDOW.SUPPORT_SPLIT" android:value="false"/>
</activity>
...
</application>

 

① Enables all activities for Split window by default.

② Activity1 is shown in the Dual window App Drawer, allowing users to run the application as Split window.

③ Even if omitted, Activity1 can be run as a Split window.

④ It disables Activity2 for the Split window.

 

Quick Development Guide

This section provides the very quick example of the Dual window application. You can creates the basic application printing the “Hello, World” and convert it into the Dual window application. And then, you can execute it on the actual LG smartphone with Dual window mode.

Creating a Project

First, creates an Android application project.

 

1. Start Eclipse.

 

2. Select File > New > Android Application Project.

 

 

3. Fill in the form as follows.

  • Application Name: Enter the appropriate name for your application.
  • Project Name: Enter the appropriate name for your application.
  • PackageName: Enter the appropriate name for your application
  • Minimum Required SDK: Select the 'API 19: Android 4.4 (Kit Kat)'.

 

4. Check the boxes if you need to and click Finish.

 

 

Converting the Project into Dual window Application

Open the AndroidManifest.xml and add the following meta-data.

 

 <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.lge.support.SPLIT_WINDOW" android:value="true"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

 

The application’s height or width is reduced on Dual window mode compared to Full screen mode. When you convert an existing application into Dual window application, you need to consider adding a scroll bar on the layout.

 

Running the application on LG Smartphones with Dual window Mode

You can run the application on real devices as follows:

 

1. Connect your smart phone to PC.

 

If your PC does not recognize the device, install the USB driver for LG smartphones from the LG Electronics website: http://www.lg.com.

 

2. To Check that the connection is successful, switch to the DDMS window. If the connection is successful, you can see the device’s name on the DDMS window in Eclipse.

 

3. Run the project by selecting menus: project’s name > Run as > Android Application.

 

4. When the pop-up window appears, select Choose a running Android device and then click OK.

 

5. Execute the application on the device.

1) Execution with Full screen mode

 

 

2) Execution with Dual window mode

Start the Dual window App Drawer by holding the back button. Choose two applications in the App Drawer.

 

  

Navigation