how to use runOnUiThread without getting “cannot make a static reference to the non static method” compiler error

后端 未结 4 569
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 15:53

I have a main class;

  ClientPlayer extends Activity {

and a service

  LotteryServer extends Service implements Runnable {
         


        
4条回答
  •  盖世英雄少女心
    2021-02-13 15:59

    You can get the instance of your Activity, pass it to the service, and use that instead of the class name.

    then you can use:

    yourActivity.runOnUiThread( ...
    

提交回复
热议问题