我有一个主要课程;
ClientPlayer extends Activity {
和服务
LotteryServer extends Service implements Runnable {
尝试在此服务的运行方法中使用 RunOnUiThread 时出现编译器错误,“无法对非静态方法进行静态引用”
如何解决这个问题?,这里显示了我如何使用代码;
@Override
public void run() {
// I tried both ClientPlayer.runOnUiThread and LotteryServer.runOnUiThread
// both don't work
ClientPlayer.runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(), "from inside thread", Toast.LENGTH_SHORT).show();
}
});
} // end run method