Embedded webview crashes on dialog

by siliconeagle » Wed, 19 Aug 2009 00:39:19 GMT

Sponsored Links
 I have an application that uses the webview to load webpages so user
can download media off them, but i get a crash when any sort of popup
tries to show (eg from a select box or save password dialog) - the
error is that for some reason the webview doesnt provide the new
dialog with the application context (even though it as passed to the
webview component when it was created).

Is there some method to use to supply the application context to
dialogs launched from the webview?



Embedded webview crashes on dialog

by Balwinder Kaur (T-Mobile USA) » Wed, 19 Aug 2009 01:08:52 GMT

 Could you post your code and the stack trace, please ?
Balwinder Kaur
Open Source Development Center
T  Mobile stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


Sponsored Links

Embedded webview crashes on dialog

by siliconeagle » Wed, 19 Aug 2009 18:59:31 GMT

 the stacktrace is :
W/dalvikvm( 1547): threadid=3: thread exiting with uncaught exception
E/AndroidRuntime( 1547): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime( 1547): android.view.WindowManager$BadTokenException:
Unable to add window -- token null is not for an application
E/AndroidRuntime( 1547):        at android.view.ViewRoot.setView
E/AndroidRuntime( 1547):        at android.view.WindowManagerImpl.addView
E/AndroidRuntime( 1547):        at android.view.WindowManagerImpl.addView
E/AndroidRuntime( 1547):        at android.app.Dialog.show(Dialog.java:231)
E/AndroidRuntime( 1547):        at android.webkit.WebView$InvokeListBox.run
E/AndroidRuntime( 1547):        at android.os.Handler.handleCallback
E/AndroidRuntime( 1547):        at android.os.Handler.dispatchMessage
E/AndroidRuntime( 1547):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1547):        at android.app.ActivityThread.main
E/AndroidRuntime( 1547):        at java.lang.reflect.Method.invokeNative
(Native Method)
E/AndroidRuntime( 1547):        at java.lang.reflect.Method.invoke
E/AndroidRuntime( 1547):        at com.android.internal.os.ZygoteInit
E/AndroidRuntime( 1547):        at com.android.internal.os.ZygoteInit.main
E/AndroidRuntime( 1547):        at dalvik.system.NativeStart.main(Native
I/Process (   58): Sending signal. PID: 1547 SIG: 3
I/dalvikvm( 1547): threadid=7: reacting to signal 3
I/dalvikvm( 1547): Wrote stack trace to '/data/anr/traces.txt'

the code is quite basic:
webView = new WebView(getApplicationContext());

is there another context i should use?

On Aug 18, 6:08pm, "Balwinder Kaur (T-Mobile USA)" <balwinder.k...@t-


Other Threads

1. Using Google Gears inside a web view

Hi, I am trying to use a Google Gears enabled site in Android's
WebView, but it fails, saying Gears is not installed.

For example, my test application sets up a WebView and loadUrls:

and I see a "Gears is not installed" message.

The WebSettings on the WebView has JavaScript and Plugins enabled.
WebView.getPluginList is empty.

import java.util.List;

import android.app.Activity;
import android.graphics.Path;
import android.graphics.drawable.GradientDrawable.Orientation;
import android.os.Bundle;
import android.webkit.Plugin;
import android.webkit.PluginList;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.LinearLayout;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        WebView webView = new WebView(this);
                WebSettings settings = webView.getSettings();
                PluginList pluginList = webView.getPluginList();
                List list = pluginList.getList();
                for(int i = 0; i < list.size(); i++)
                        Plugin plugin = (Plugin)list.get(i);

                LinearLayout layout = new LinearLayout(this);
                Button button = new Button(this);


2. Runtime exception with JSONObject.put() ???


When I call:

    JSONObject j= new JSONObject();
    j.put("mykey", "hello");

I get a runtime exception which has a message of:


This worked fine in the beta version before the final release. Are we
not supposed to be using this, or ..?


3. AndroidHttpClient gone so now what

4. problems installing the sample NotePad application from the web

5. Android application stopped unexpected ly

6. NotePad sample app fails to install over the web

7. Anyone mind testing quickly?