Android LunarLander and JetBoy Example Differences
Hallo,
开发者_JAVA技巧I noticed that the keypress handling ('onKeyUp' etc) in the SDK LunarLander example is in the View class, whereas in the JetBoy example it is in the Activity class. Are there any advantages/disadvantages to either solution?
My own thoughts would be that it would be nicer to put all input handling (Key, Click & Touch) into the Activity, as that doesn't do much.
- Frink
Depends on what is being accomplished as events are passed up to whatever class has methods to handle them..
One example where key/touch events are handled at the view level is if you have multiple views in one screen..
An example of events handled in activity is when you customize a titlebar you will capture the key/touch events at the activity level.simply because you may have buttons on the titlebar triggering another activity.
精彩评论