我收到以下错误:
Error:(104, 51) error: constructor CountDownTimer in class CountDownTimer cannot be applied to given types;
required: long,long
found: no arguments
reason: actual and formal argument lists differ in length
这是我的代码:
class C06964 extends CountDownTimer {
/* renamed from: com.aplikasi.gokil.MyActivity.4.1 */
class C06941 extends CountDownTimer {
final /* synthetic */ Toast val$toast;
C06941(long x0, long x1, Toast toast) {
this.val$toast = toast;
super(x0, x1);
}
public void onTick(long millisUntilFinished) {
this.val$toast.show();
}
public void onFinish() {
this.val$toast.cancel();
}
}
/* renamed from: com.aplikasi.gokil.MyActivity.4.2 */
class C06952 extends CountDownTimer {
final /* synthetic */ Toast val$toast;
C06952(long x0, long x1, Toast toast) {
this.val$toast = toast;
super(x0, x1);
}
public void onTick(long millisUntilFinished) {
this.val$toast.show();
}
public void onFinish() {
this.val$toast.cancel();
MyActivity.this.startActivity(IntentCompat.makeRestartActivityTask(MyActivity.this.getPackageManager().getLaunchIntentForPackage(MyActivity.this.getPackageName()).getComponent()));
System.exit(0);
}
}
C06964(long x0, long x1) {
super(x0, x1);
}
public void onTick(long millisUntilFinished) {
((TextView) MyActivity.this.findViewById(id.textView)).setText("Restart Application In : " + (millisUntilFinished / 1000));
Toast toast = Toast.makeText(MyActivity.this.getBaseContext(), "Restart Application In : " + (millisUntilFinished / 1000), 0);
toast.show();
new C06941(1000, 1000, toast).start();
}
public void onFinish() {
Toast toast = Toast.makeText(MyActivity.this.getBaseContext(), "Restarting Application...", 0);
toast.show();
((TextView) MyActivity.this.findViewById(id.textView)).setText("Restarting Application...");
new C06952(3000, 3000, toast).start();
}
}
有人可以解释一下为什么我收到此错误吗?
最佳答案
Invocation of a superclass constructor must be the first line in the subclass constructor. - Using the Keyword super
您的构造函数在设置 this.val$toast = toast
后调用 super(x0, x1)
。
关于java - CountDownTimer 类中的构造函数 CountDownTimer 无法应用于给定类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38535513/