2014-01-11 29 views
1

我在count fragment中添加runnable,如下面的代碼。如何在另一個calss中調用Runnable?

public static Runnable getTime = new Runnable() { 

    @Override 
    public void run() { 
     // TODO Auto-generated method stub 
     Long spentTime = System.currentTimeMillis() - startTime; 
     Long minius = (spentTime/1000)/60; 
     Long seconds = (spentTime/1000) % 60; 
     RecordTime.setText(record_time_text + minius + ":" + seconds); 

     mHandler.postDelayed(this, 1000); 
    } 
}; 

而且我要調用其他class

runnable但它不能被count.getTime打電話runnable

如何在另一個​​中調用Runnable

+0

你試過'count.getTime.run()'嗎? – Henry

回答

1

以靜態方式調用它。如果課程是Count那麼Count.getTime.run()應該工作。希望能幫助到你!

相關問題