Why use Handler?

后端 未结 4 1925
傲寒
傲寒 2021-02-01 10:25

I came across this code in a very basic Handler tutorial. The code is working fine but I do not understand why I have to use Handler for progressDialog.dismiss()

4条回答
  •  天命终不由人
    2021-02-01 10:52

    The easier the better. Instead of using a handler, you could try to use the following code:

    runOnUiThread(
        new Runnable() { 
            public void run() 
            { 
    
            //Update user interface here
    
            } 
        }
    );
    

    Don't make your life to complicated ;)

提交回复
热议问题