【发布时间】:2018-03-04 04:35:27
【问题描述】:
我有这些变量:
private boolean MineRunning;
private BigInteger MineProfit;
etc....
我要调用倒计时方法:
countdown(MineRunning, MineProfit, MineTime, MineProgressbar, MineProgressstatus);
大约。 10 次不同的事情
方法:
private void countdown(boolean running, BigInteger profit, BigInteger time, ProgressBar progressBar, int progressStatus) {
if(!running && Reference.Storage_Filled.add(profit).compareTo(Reference.Storage_Capacity) == 0 ||
!running && Reference.Storage_Filled.add(profit).compareTo(Reference.Storage_Capacity) == -1){
running = true;
new CountDownTimer(time.longValue(), Reference.countDownInterval.longValue()){
public void onTick(long millisUntilFinished){
progressStatus++;
progressBar.setProgress(progressStatus);
}
public void onFinish(){
Reference.totalGravel = Reference.totalGravel.add(profit);
Gravelrefresh();
progressStatus = 0;
progressBar.setProgress(progressStatus);
running = false;
}
}.start();
}
}
如果我调用这个方法我得到一个错误:
从内部类中访问变量
我不想将变量设为final,因为我必须在方法中编辑这些。我能做些什么呢?
谢谢。
【问题讨论】:
标签: java android variables methods