¡Esta es una revisión vieja del documento!
There are several classes inside the SDK which are useful to develop Android applications…
An application at least has an activity. Activity initialization is in onCreate() method, there you'll:
First line of onCreate() method has to be super.onCreate.
To access another activity we'll use findViewById method.
To start an activity programatically…
startActivity or startActivityForResult.
The activity will be activated between the onStart and the onStop steps.
The activity will be visible in the foreground between the onResume and the onPause steps.
onRestart is called when the activity has been stoped and is about to be called again.
onResume happens when the activity is about to start interacting with the user.
A task is a set of related Activities, they don't have to be part of the same application. A task could be the contacts screen, which can be called from single activities.
Detection of configuration changes like change the mobile orientation from portrait to landscape.
R class is an authomaticly generated class to access resources from code.
Accessing resources from code:
R.layout.layout_name
Strings are stored in res/values/*.xml file, can store visual styles as well as text, and there are three types:
A string definition is:
<string name="hello">Hello world!</string>
To access them from other resources we will do:
@string/string_name
The UI for applications in xml format. They are stored in res/layout/*.xml files.
To access them from other resources we will do:
@layout/layout_name
It's a file that defines the developed application. It includes…
It's the Android main logs viewer. To use it you only need to import the android.util.Log class and call it:
Log.i(ID, MSG), produces an INFO message.Log.d(ID, MSG), produces a DEBUG message.Log.e(ID, MSG), produces an ERROR message.Log.v(ID, MSG), produces a VERBOSE message.Url for the device is localhost accessed with the port specified on the window title of the emulator.
To access from other emulator, this number will act as the phone number (p.ex. to send SMS).
If the number on the window title was 5554, then the command to connect by telnet to the emulator would be:
$ telnet 127.0.0.1 5554
I could emulate an SMS from 5556 number using the command:
sms send 5556 "hi!"
Other commands to configure the emulator could be:
network speed edgenetwork speed fullpower status not-charginggeo fix 0.00 0.40It's accessed from Eclipse as another perspective. It has several sub-applications which could be useful…
You only need to add another resource folder which name ends with the country code target. P.ex, for spanish it would be: values-es.