Changing image in imageview using Threads

前端 未结 6 1019
失恋的感觉
失恋的感觉 2020-12-11 10:05

I\'m getting error with this code. Why huhu 123123123

Thread timer = new Thread()
{
    public void run()
    {
        try
        {
            sleep(1500)         


        
6条回答
  •  独厮守ぢ
    2020-12-11 10:47

    You can not use normal threading on android system. Give you some example on thread on android :D

    ---> Android Asynctask

    Android Developer - Android Asynctask

    You can use this for some loading effect on UI in android.

    ---> runOnUiThread

    In your case, I suggest to use this. You can have more detail here.

    Click for detail

    USEAGE::

    runOnUiThread(new Runnable() {
    
      @Override
      public void run() {
        // Do you ui update here
      }
    
    });
    

提交回复
热议问题