当我在姜饼设备上运行应用程序时,WebView崩溃

时间:2011-12-21 23:40:49

标签: android android-webview

我是android的初学者,我的应用程序在调试模式下运行,但是当我运行它时崩溃了 这是我的代码。
我想在webview中打开第三方应用程序 这个应用程序使用javascript,它正在Android 2.3 GingerBread上使用。

public class Classname extends Activity 
{
    WebView webView;
    String realm;
    String username;
    String password;
    String host;
    public String pwd;
    @Override
    public void onCreate(Bundle savedInstanceState)
    {   

        setContentView(R.layout.webpage);
        super.onCreate(savedInstanceState);
        webView = (WebView)findViewById(R.id.browser);
        //final WebPage webpage=new WebPage(webView);
        //webView.getSettings().setJavaScriptEnabled(true);
        webView.setVerticalScrollbarOverlay(true);
        //call url from database
        ClassName.geturl(getContext(),  new Callback<String>(getContext()){
            @Override
            public void onCompleted(String value) {
                super.onCompleted(value);
                try 
                {
                    JSONObject respObj = new JSONObject(value);
                    String apserver = respObj.getString("value");
                    //webView.loadUrl("http://yahoo.com");

                    webView.getSettings().setJavaScriptEnabled(true);
                    webView.setWebViewClient( new WebViewClient(){
                    //passing username and pasword  
                    public void onReceivedHttpAuthRequest  (WebView view,HttpAuthHandler handler, String host,String realm){ 

                        final String uname=App.getConfig().getUid();

                        try {
                            pwd = EncryptDecrypt.decrypt(function.getPassword());
                        } catch (Exception e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    handler.proceed(uname, pwd);

                    }}
                    );
                    webView.loadUrl("application");


                    ;}

                           catch(Exception e)
                            {

                            }
                    return;
            }
        });
    }


}

logcat的:

12-20 13:34:17.160: E/AndroidRuntime(10452): FATAL EXCEPTION: WebViewCoreThread
12-20 13:34:17.160: E/AndroidRuntime(10452): java.lang.IllegalArgumentException: Method name may not be null
12-20 13:34:17.160: E/AndroidRuntime(10452): at org.apache.http.message.BasicHttpRequest.<init>(BasicHttpRequest.java:57)
12-20 13:34:17.160: E/AndroidRuntime(10452): at android.net.http.Request.<init>(Request.java:123)
12-20 13:34:17.160: E/AndroidRuntime(10452): at android.net.http.RequestQueue.queueRequest(RequestQueue.java:333)
12-20 13:34:17.160: E/AndroidRuntime(10452): at android.webkit.Network.requestURL(Network.java:191)
12-20 13:34:17.160: E/AndroidRuntime(10452): at android.webkit.LoadListener.doRedirect(LoadListener.java:1371)
12-20 13:34:17.160: E/AndroidRuntime(10452): at android.webkit.LoadListener.handleMessage(LoadListener.java:236)
12-20 13:34:17.160: E/AndroidRuntime(10452): at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 13:34:17.160: E/AndroidRuntime(10452): at android.os.Looper.loop(Looper.java:123)
12-20 13:34:17.160: E/AndroidRuntime(10452): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:629)
12-20 13:34:17.160: E/AndroidRuntime(10452): at java.lang.Thread.run(Thread.java:1019)

0 个答案:

没有答案