IBM Worklight v5.0.5 > Develop IBM Worklight applications > Development guidelines for mobile environments > Web and native code in iPhone, iPad, and Android

Receive data from the web view in a Java page

Implement this page as an Activity object or extend an Activity. Declare this activity in AndroidManifest.xml.

To receive data from the calling web view, use the Intent object defined on the native Activity. The IBM Worklight client framework makes the data available to the Activity in a Bundle.

// Send data from web view to the native Activity'', 
                    this.callback, {"gameLevel":1,"playerName":"john",isKeyboardEnable:false});

// Receive the data in the native Activity

public void onCreate(Bundle savedInstanceState) 

    //Read int value, default = 0
    Integer gameLevel = getIntent().getIntExtra("gameLevel", 0);

    //Read String value
    String playerName = getIntent().getStringExtra("playerName");

    //Read boolean value, default = false
    Boolean isKeyboardEnable = getIntent().getBooleanExtra("isKeyboardEnable", false);

Parent Web and native code in iPhone, iPad, and Android

Related information: