Implement Android activities in GMA

Androidâ„¢ activities can be bundled with your GMA app and called from the Genero code.

A Java-based extension that interacts with the end user must be implemented as an Android Activity, by using the class.

In order to use your Android Activity from the program, it must be integrated in the mobile app Android package (.apk), which is created in the Genero Studio deployment procedure.

This code example implements a simple Android Activity:
package com.myextension;

import android.os.Bundle;
import android.widget.TextView;

public class MyActivity extends Activity {
    protected void onCreate(Bundle savedInstanceState) {
        Button button = new Button(this);
             new View.OnClickListener() {
             public void onClick(View v) {
                 int resultCode = RESULT_OK;
                 Intent resultData = new Intent();
                 resultData.putExtra("MyKey", "MyValue");
                 setResult(resultCode, resultData);
In order to execute this activity from a Genero app, use the startActivity front call:
    DEFINE data, extras STRING
        ON ACTION activity ATTRIBUTES(TEXT="Call bundled activity")
            CALL ui.Interface.frontCall("android", "startActivityForResult",
                 ["android.intent.action.VIEW", NULL, NULL, NULL,
                 [ data, extras ])
                 MESSAGE "data=",data," / extras=",extras
        ON ACTION quit
            EXIT MENU
Note: The component name (fifth parameter) of the startActivity front call does normally take the APK package name followed by the Java Activity class name (apk-package-name/java-class-name). The APK Android package name can be defined for the application project in Genero Studio. When using an user-defined activity that is part of the GMA binary archive, do not specify the APK package in the component parameter, because the Java Activity class will be included in the current APK package. This is true when using the customized GMA front-end in development mode, and in the final application that is deployed on the device. For more details about the component parameter, see startActivity (Android).