Exemple #1
0
        /// <summary>
        /// Invoked when the Activity is created.
        /// </summary>
        /// <param name="savedInstanceState"> a Bundle containing state saved from a previous
        ///        execution, or null if this is a new execution </param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // tell system to use the layout defined in our XML file
            SetContentView(R.Layouts.lunar_layout);

            // get handles to the LunarView from XML, and its LunarThread
            mLunarView   = (LunarView)FindViewById(R.Ids.lunar);
            mLunarThread = mLunarView.Thread;

            // give the LunarView a handle to the TextView used for messages
            mLunarView.TextView = (TextView)FindViewById(R.Ids.text);

            if (savedInstanceState == null)
            {
                // we were just launched: set up a new game
                mLunarThread.state = LunarView.LunarThread.STATE_READY;
                Log.W(GetType().Name, "SIS is null");
            }
            else
            {
                // we are being restored: resume a previous game
                mLunarThread.RestoreState(savedInstanceState);
                Log.W(GetType().Name, "SIS is nonnull");
            }
        }
Exemple #2
0
        /// <summary>
        /// Invoked when the Activity is created.
        /// </summary>
        /// <param name="savedInstanceState"> a Bundle containing state saved from a previous
        ///        execution, or null if this is a new execution </param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // 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.Thread;

            // give the LunarView a handle to the TextView used for messages
            mLunarView.TextView = (TextView) FindViewById(R.Id.text);

            if (savedInstanceState == null)
            {
                // we were just launched: set up a new game
                mLunarThread.state = LunarView.LunarThread.STATE_READY;
                Log.W(GetType().Name, "SIS is null");
            }
            else
            {
                // we are being restored: resume a previous game
                mLunarThread.RestoreState(savedInstanceState);
                Log.W(GetType().Name, "SIS is nonnull");
            }
        }