让我们说ActivityA.java
,我们有:
public static Car mCar = new Car();
然后在ActivityB.java中,我们有:
horn.setOnTouchListener( myOnTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mCar.Honk();
break;
}
return true;
当谈到“ActivityA.mCar.Honk();
”时,我是否会收到一条恼人的红色下划线,告诉我无法访问这个或那个?