Hi,
I have been working through the lunarlander example application, in an
attempt to understand the source code. I have run into a couple of
problems, and would really appreciate if someone could space a couple
of minutes to assist in may understanding.
The onCreate method contains the following:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// turn off the window's title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
// tell system to use the layout defined in our XML file
setContentView(R.layout.lunar_layout);
// get handles to the LunarView from XML, and its LunarThread
mLunarView = (LunarView) findViewById(R.id.lunar);
mLunarThread = mLunarView.getThread();
// give the LunarView a handle to the TextView used for
messages
mLunarView.setTextView((TextView) findViewById(R.id.text));
if (savedInstanceState == null) {
// we were just launched: set up a new game
mLunarThread.setState(LunarThread.STATE_READY);
Log.w(this.getClass().getName(), "SIS is null");
} else {
// we are being restored: resume a previous game
mLunarThread.restoreState(savedInstanceState);
Log.w(this.getClass().getName(), "SIS is nonnull");
}
}
I can see that we are performing the following:
Turn off the title bar in the window
Set the activity content to the lunar_layour layout file
gets a reference to the 'lunar' layout
gets a reference to the thread member of the LunarView class
give the LunarView a reference to the textview for game messages
we then set the state of the lunar thread to STATE_READY, which also
outputs a bunch of status messages
The problem is that after executution of setState, the code seems to
end. I can see no sections of code that actually creates the LunarView
or LunarThread objects, which are required to start the game proper.
Obviously I am missing something here, I was wondering if anyone could
assist! Thanks lots!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---