Ok, I found the answer to my question on the android google group.
In m5, there is a new class called WebViewClient that seems to replace a callback approach in m3 for handling specific features of a WebView.
So basically, the way to do it in a search scenario would be:
Using java Syntax Highlighting
package com.android.test.search;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
public class SearchAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
Button convert = (Button) findViewById(R.id.search);
convert.setOnClickListener(new Clicker(this));
WebView webView = (WebView) findViewById(R.id.webView);
webView.loadData(
"<html><body>Please click on search after entering a criteria</body></html>",
"text/html", "utf-8");
// Force the browser to stay in the original layout
WebViewClient wv = new WebViewClient();
wv.shouldOverrideUrlLoading(webView, "http://www.google.com");
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.setWebViewClient(wv);
}
class Clicker implements Button.OnClickListener
{
Context context;
public Clicker(Context context)
{
this.context = context;
}
public void onClick(View v)
{
EditText searchText = (EditText)findViewById(R.id.searchtext);
WebView webView = (WebView) findViewById(R.id.webView);
//searchText.setText(Integer.toString(webView.getHeight()) + "x" + Integer.toString(webView.getWidth()));
if(searchText.length()==0)
{
context.showAlert("Android Search", 0, "No search criteria", "Close", false);
}
else
{
webView.loadUrl("http://www.google.com/search?q=" + searchText.getText().toString());
}
}
}
}
Parsed in 0.037 seconds, using
GeSHi 1.0.8.4