How to use notifyDataSetChanged() in thread

前端 未结 5 1876
醉话见心
醉话见心 2020-12-03 05:00

I create a thread to update my data and try to do notifyDataSetChanged at my ListView.

private class ReceiverThread extends Thread {

@Override
         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-03 05:30

    You can write in this way also.

      new Handler().postDelayed(new Runnable() {
                    public void run() {
                        test();
                    }
                }, 100);
    
    private void test() {
        this.notifyDataSetChanged();
    }
    

    just test it.

提交回复
热议问题