Site Loader
Auckland, New Zealand
In this post we will start our discussion to create hybrid application in Android to test using Robotium. Here is the complete code for the Hybrid Application which we are about to create.
package com.example.executeautomationapp;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.app.Activity;

public class EAActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_ea);
		
		WebView mainView = (WebView) findViewById(R.id.webviewMain);
		
		WebSettings settings = mainView.getSettings();
		settings.setJavaScriptEnabled(true);
		
		mainView.setWebViewClient(new MyCustomView());
		mainView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
		
		//Set the URL of our app
		mainView.loadUrl("http://www.executeautomation.com/blog");
	}
	
	private class MyCustomView extends WebViewClient {
		public boolean shouldOverrideURL(WebView view, String url)
		{
			view.loadUrl(url);
			return true;
		}
	}

	
}

Here is the complete video of the above discussion Thanks for reading the post and watching the video !!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK

Post Author: Karthik kk

2 Replies to “Developing Hybrid Application for Robotium automation”

Leave a Reply

Your email address will not be published. Required fields are marked *