I try to follow this example ChronometerDemo.java, but I got some problem:
- I can’t import android.widget.Chronometer;
Error: conflicts with a type defined in a same file(import android.widget.Chronometer.OnChronometerTickListener) - I can’t cast View to Chronometer
mChronometer = (Chronometer) findViewById(R.id.chronometer);
Anyone can help? Appreciate,
Daisy
There seems to be another
Chronometerclass present that does not extend fromView, which is why you can’t cast it. It’s hard to tell without your code, but did you renameChronometerDemo.javatoChronometer.java?ChronometerDemois an Activity, and is not supposed to be returned by afindViewByIdcall.This is, of course, assuming you’re talking about this.