这很奇怪,也许有人可以帮忙。我有两个类,当我尝试从主类访问变量时,值始终为 0.0
MAIN CLASS
public class MainActivity extends Activity {
public float angleCurrent;
- do something whith angleCurrent
//System.out.println(angleCurrent); - I get right values
}
SECOND CLASS
public class SecondClass extends ImageView {
public float curAngle = new MainActivity().angleCurrent;
//System.out.println(curAngle); - I get 0.0 all the time
}
代码只是说明。