没有啊,按返回键之后,进度条会消失,但是onKeyDown方法里面标志打印不出来。
我的想法是在开启网络线程的时候出现进度条,如果按返回键,进度条消失,新网络线程结束。

解决方案 »

  1.   

    可以的    
    见过一个   
    那个点击 back 后 进度条  逐渐减少到0  然后退出
      

  2.   

    我现在确实捕获不到,不过找到了一个办法
    progressDialog.setOnCancelListener();
    貌似在的按返回键的时候,会执行这个方法里面的操作。能给我一个能捕获到的例子吗?
      

  3.   

    如果在对话框里的话,可以重写对话框的OnKeyListener,或者干脆设置setCancelable(false)来禁用取消
      

  4.   

    是你的progressDialog处理完返回键消息后,此消息就结束了,没有继续向上传吧,导致网络线程接收不到返回键。
      

  5.   

    public boolean onKeyDown (int keyCode, KeyEvent event) 
    Since: API Level 1 Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released, if the view is enabled and clickable.Parameters
    keyCode  A key code that represents the button pressed, from KeyEvent. 
    event  The KeyEvent object that defines the button action.  Returns
    If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. 

    楼主可以在progressDialog处理返回键消息的时候返回false。
      

  6.   

    现在我的问题已经解决,可以通过progressDialog.setOnCancelListener();方法来中断子线程。
    关键是为什么进度条show以后,public boolean onKeyDown (int keyCode, KeyEvent event)  方法就不会响应啦?
      

  7.   

    进度条show以后,进度条所在view就成了最上面处于活动的,所以它获得焦点,接收键消息。
    其他的view就接收不到焦点了。