The document discusses starting another activity in Android mobile software engineering. It explains that an intent carries data through key-value pairs called extras between components like activities. Keys for extras should be prefixed with the app's package name to ensure uniqueness. The document provides an example of starting a new activity by creating an intent, adding an extra string message, and calling startActivity. It also covers the activity lifecycle methods like onPause(), onResume(), and onSaveInstanceState(). The rest of the document lists additional advanced Android training topics.
5. It’s a good practice..
to define keys for intent extras using your app's package name as a prefix.
This ensures they are unique, in case your app interacts with other apps.
14. onPasue()
@Override
public void onPause() {
// Always call the superclass method first
super.onPause();
// Release the Camera because
// we don't need it when paused
// and other activities might need to use it.
if (mCamera != null) {
mCamera.release()
mCamera = null;
}
}
15. onResume()
@Override
public void onResume() {
// Always call the superclass method first
super.onResume();
// Get the Camera instance as the activity
// achieves full user focus
if (mCamera == null) {
// Local method to handle camera init
initializeCamera(); }
}
21. 'Must Override a Superclass
Method' Errors after importing a
project into Eclipse Problem
http://stackoverflow.com/questions/1678122/must-override-a-superclass-
method-errors-after-importing-a-project-into-eclips
22. @Override
public boolean onTouchEvent(MotionEvent e) {
float x = e.getX(); float y = e.getY();
switch (e.getAction()) {
case MotionEvent.ACTION_MOVE:
float dx = x - mPreviousX; float dy = y - mPreviousY;
// reverse direction of rotation above the mid-line
if (y > getHeight() / 2) { dx = dx * -1 ; }
// reverse direction of rotation to left of the mid-line
if (x < getWidth() / 2) { dy = dy * -1 ; }
mRenderer.mAngle += (dx + dy) * TOUCH_SCALE_FACTOR;
// = 180.0f / 320
requestRender();
}
mPreviousX = x; mPreviousY = y;
return true;
}