LunarLander例子研究

Lunar adj. 月亮的; ~ landing 登月

Lander n. 着陆舱

1. 在LunarLander.onCreate方法中

// 获取LunarView和LunarThread

mLunarView = (LunarView) findViewById(R.id.lunar);
mLunarThread = mLunarView.getThread();

// 如果savedInstanceState等于NULL

mLunarThread.setState(LunarThread.STATE_READY);

// 如果savedInstanceState不等于NULL

mLunarThread.restoreState(savedInstanceState);

2. 在LunarLander.onPause方法中

// 调用LunarThread的pause方法

mLunarView.getThread().pause();

3. 在LunarLander.onSaveInstanceState(Bundle outState)方法中

// 调用LunarThread的saveState方法

mLunarThread.saveState(outState);

原文地址:https://www.cnblogs.com/fengzhblog/p/2752880.html