如何在android上避免致命信号6(SIGABRT)

时间:2014-04-08 16:51:14

标签: android multithreading

我正在使用HttpURLConnection来获取Web服务,服务器在同一个网络中,但响应可以延迟到60000ms(一些复杂原因的bcs我必须将其设置为60000ms),当我点击listview项目时web服务并等待响应并松开wifi信号并继续单击列表我的应用程序崩溃,但错误是A/libc(9052): Fatal signal 6 (SIGABRT) on android at 0x000001e5 (code=0), thread 9052 更明确:webservice call+ wifi lost+ clicks = Fatal signal 6 code=0 我试图通过以下方式避免这种情况:

  1. 阻止用户界面或显示请等待,但我的请求不要出现,因为有连续的cliks
  2. 避免UI cliks
    但没办法!请帮助,任何propo和讨论是apreciated ..

    public static boolean stopUserInteractions=false;
    private class GetXmlAndStopUI extends AsyncTask<List, Void, String> {
    
    private final ProgressDialog dialog = new ProgressDialog(context);
    
    @Override   
    protected void onPreExecute() {
        this.dialog.setMessage("Please wait...");
        this.dialog.setCancelable(false);
        this.dialog.show();
    
    }
    @Override
    protected String doInBackground(final List... items) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                webserviceCall(items[0]);
            }
        }); 
    
    return "MSG";
    }
    @Override
    protected void onPostExecute(String result) {
    stopUserInteractions=false;
            if (this.dialog.isShowing()) {  
                    this.dialog.dismiss();  
            }
    }
    }
    
    
    
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
            if (stopUserInteractions) {
                    Toast.makeText(context, "STOP!!!!", Toast.LENGTH_SHORT).show();
                     return true;
            } else {
            return super.dispatchTouchEvent(ev);
    }
    }
    

0 个答案:

没有答案