Hello,
i have a big problem and i did not find a solution for my problem.
I try to load an url and i use this tutorial: http://developer.android.com/reference/android/webkit/WebView.html
My Code:
public class HomeView extends Activity
{
WebView mWebView;
public void onCreate(Bundle savedInstanceState)
{
try
{
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.de");
}
catch (Exception e) {
}
}
}`
my home.xml:
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
Now my problem. If i start the program everything works fine. The page is loading and i see it on the screen. but then after everything is loaded, i get the following message (the application has stopped unexpectedly. please try again.) and my programm is terminated.
Hope somebody can help me.
Cheers, Roland
My Log:
`09-16 12:59:14.154: WARN/cache(1204): Unable to create webviewCache directory
09-16 12:59:18.432: DEBUG/dalvikvm(1204): GC_FOR_MALLOC freed 1931 objects / 221256 bytes in 195ms
09-16 12:59:18.522: WARN/dalvikvm(1204): threadid=13: thread exiting with uncaught exception (group=0x4001d800)
09-16 12:59:18.632: ERROR/AndroidRuntime(1204): FATAL EXCEPTION: WebViewWorkerThread
09-16 12:59:18.632: ERROR/AndroidRuntime(1204): java.lang.NullPointerException
09-16 12:59:18.632: ERROR/AndroidRuntime(1204): at android.webkit.WebViewDatabase.getCacheTotalSize(WebViewDatabase.java:734)
09-16 12:59:18.632: ERROR/AndroidRuntime(1204): at android.webkit.CacheManager.trimCacheIfNeeded(CacheManager.java:548)
09-16 12:59:18.632: ERROR/AndroidRuntime(1204): at android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:190)
09-16 12:59:18.632: ERROR/AndroidRuntime(1204): at android.os.Handler.dispatchMessage(Handler.java:99)
09-16 12:59:18.632: ERROR/AndroidRuntime(1204): at android.os.Looper.loop(Looper.java:123)
09-16 12:59:18.632: ERROR/AndroidRuntime(1204): at android.os.HandlerThread.run(HandlerThread.java:60)
09-16 12:59:18.712: WARN/ActivityManager(65): Force finishing activity de.test.webview/.HomeView
09-16 12:59:19.283: WARN/InputManagerService(65): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@43ecba70 (uid=10035 pid=1204)
09-16 12:59:21.976: DEBUG/dalvikvm(263): GC_EXPLICIT freed 65 objects / 2968 bytes in 4365ms
09-16 13:00:39.013: DEBUG/SntpClient(65): request time failed: java.net.SocketException: Address family not supported by protocol
09-16 13:04:19.383: INFO/Process(1204): Sending signal. PID: 1204 SIG: 9
09-16 13:04:19.474: WARN/InputManagerService(65): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43e92c50
09-16 13:04:19.742: INFO/ActivityManager(65): Process de.test.webview (pid 1204) has died. `