代码之家  ›  专栏  ›  技术社区  ›  Steven Shih

关于Android中的登月器(内部类)

  •  0
  • Steven Shih  · 技术社区  · 14 年前

    我对安卓很陌生。

    对java也很陌生,所以请随时给我一些建议,我会非常感激的。

    问题在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;
    

    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
    

    我只学习了C和C++

    所以我不明白为什么我可以调用一个内部类??

    1 回复  |  直到 14 年前
        1
  •  1
  •   Sergey Glotov Nitesh Khosla    14 年前

    LunarThread 通过 LunarView.LunarThread 或导入类 月牙

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

    请参阅任何有关Java的书籍以获取参考。