+

Search Tips   |   Advanced Search

Returning control to the web view from a Java page

To switch back to the web view, follow these instructions

The page must be implemented as an Activity object or extend an Activity. As with any other activity, we must declare this activity in the AndroidManifest.xml file.

In the native page, call the finish() function of the Activity. We can pass data back to the web view by creating an Intent object.


Example

Passing data and control to the web view:

Intent gameInfo = new Intent ();
gameInfo.putExtra("winnerScore", winnerScore);
gameInfo.putExtra("winnerName", winnerName);
setResult(RESULT_OK, gameInfo); 
finish();

Receiving the data in the web view:


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

Related information:

http://developer.android.com/reference/android/app/Activity.html