1
  1. Add a logging to your Droid1 project. Within the onCreate() callback method, add an informational logging message, using the Log.i() method. Run the application and view the log results.

[For example, where would I type "onCreate()"? In the manifest? and under what

  1. Implement some of the Activity callback methods in addition to onCreate(), such as onStart(), onRestart(), onResume(), onPause(), onStop(), and onDestroy(). Add a log message to each callback method and then run the application normally. View the log result to trace the application life cycle. Next, try some other scenarios, such as pausing or suspending the application and then resuming. Simulate an incoming call. Watch the application log to see how the activity responds to such events.

[ I understand how to simulate calls through the DDMS and etc., but other than that, I am clueless on where to type and of that code, and what variables if any to include.

I am running the latest Android SDK and using Eclipse.

EDIT: No this is not homework, this is from the Sam's Teach Yourself Book

EDIT(Revised): Once I get this.. public void onCreate(Bundle savedInstance) { ... code ... }

where do I post this, in the Manifest.xml? under activity such as < activity >?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Chris P
  • 11
  • 2
  • This is a duplicate of http://stackoverflow.com/questions/5228160/what-exactly-does-using-the-application-context-mean/5228494#5228494 – erichamion Mar 08 '11 at 20:36

2 Answers2

2

Android SDK uses Java as programming language. If you're familiar with Java you should start reading this:

Android Dev Guide

An activity in android SDK its (copy and paste) "[...]a single, focused thing that the user can do[...]". Here it is the whole explanation:

Activity guide

Good luck with your exercise :)

EdChum
  • 376,765
  • 198
  • 813
  • 562
jLuengas
  • 71
  • 6
1

When you create a new Android project you will start out with a template activity, usually called MainActivity.java.

Inside this file you will see:

public void onCreate(Bundle savedInstance) {
   ... code ...
}

This is the onCreate() method. You can change the ... code ... part and try to use code from your book instead.

After you've played around with that a bit you can move on to more complicated code examples, such as the Samples section of the sdk.

Matthew
  • 44,826
  • 10
  • 98
  • 87