Android Async, Handler or Timer?

后端 未结 3 721
误落风尘
误落风尘 2021-02-09 03:24

Every 5 seconds, I want to call my webservice and get text (not images), then display it in my ImageAdapter. What would be the best way to accomplish this?

3条回答
  •  眼角桃花
    2021-02-09 04:16

    final Handler handler = new Handler(); 
        final Runnable r = new Runnable()
        {
            public void run() 
            {
                callWebservice();
            }
        };
    
        handler.postDelayed(r, 5000);
    

提交回复
热议问题