tags:

views:

37

answers:

1

hi, I am very new to android.

Also very new to java, so please feel free to give me any advice, I would very appreciate it.

the question is in lunarlander.java

/** A handle to the thread that's actually running the animation. */
private LunarThread mLunarThread;

/** A handle to the View in which the game is running. */
private LunarView mLunarView;

but in lunarview.java

class LunarView extends SurfaceView implements SurfaceHolder.Callback {

/** Handle to the application context, used to e.g. fetch Drawables. */
private Context mContext;

/** Pointer to the text view to display "Paused.." etc. */
private TextView mStatusText;


class LunarThread extends Thread

I have only learned C and C++

so i can't figure it out why can I call a inner class??

+1  A: 

Classes and fields without modifiers private or protected can be accessible from any class in the same package. We can access LunarThread by LunarView.LunarThread or import class LunarThread as done in LunarLander.java:

import com.example.android.lunarlander.LunarView.LunarThread;

See any book about Java for references.

Sergey Glotov