当我的应用程序运行时,WebViewClient崩溃

时间:2014-03-19 03:53:45

标签: android android-webview

我在我的应用程序上使用webviewclient进行Autours登录,例如foursquare,但是当我的应用程序启动时我收到错误。

错误显示如下:

E/qdutils﹕ FBIOGET_FSCREENINFO failed
A/libc﹕ Fatal signal 6 (SIGABRT) at 0x00003d60 (code=-6), thread 15712 (com.example.app)

这是我的代码:

public class AuthWebClient extends WebViewClient {
private Context context;
private HDData hdData;
private HDDBHelper hddbHelper;
private String accessToken;

public AuthWebClient(Context ctx){
    context = ctx;
}

@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url){

    String code;

    webView.loadUrl(url);

    hdData = new HDData(context, "");

    if(url.startsWith(hdData.getCallbackUrl())){
        String urls[] = url.split("=");

        code = urls[1].toString();
        ArrayList<NameValuePair> data = new ArrayList<NameValuePair>();

        data.add(new BasicNameValuePair("ClientID", hdData.getClientId()));
        data.add(new BasicNameValuePair("ClientSecret", hdData.getClientSecret()));
        data.add(new BasicNameValuePair("Code", code));
        data.add(new BasicNameValuePair("CallbackURL", hdData.getCallbackUrl()));

        hddbHelper = new HDDBHelper(context);


        AsyncTask<ArrayList<NameValuePair>, Integer, JSONObject> handler = new PostServiceHandler(hdData.getReqTokenUrl(), "", this.context) {
            @Override
            protected void onPostExecute(JSONObject result) {
                try{
                    accessToken = result.getJSONObject("AccessToken").toString();

                    if(hddbHelper.isHDDataExists(hdData.getClientId())){
                        hdData.setAccessToken(accessToken);
                        hddbHelper.updateHDData(hdData);
                    }
                    else{
                        HDData hdIn = new HDData(context, accessToken);
                        hdIn.setClientId(hdData.getClientId());
                        hdIn.setClientSecret(hdData.getClientSecret());
                        hdIn.setAccessToken(accessToken);
                        hddbHelper.addHDData(hdIn);
                    }

                }
                catch (JSONException e){
                    e.printStackTrace();
                }

            }

        }.execute(data);
    }
    return true;
}

有谁知道问题是什么?我该如何解决呢?

1 个答案:

答案 0 :(得分:0)

请从loadUrl的实施中移除对shouldOverrideUrlLoading的来电。由于负载已在进行中,因此不需要它。