Software Developer at Telefonica
This is one of three posts where we will cover how you can develop your first app. This first post covers an introduction to Android OS, a little bit of history, IDEs and the life cycle of an Android application. At the end of these three posts, you should have enough skills to create your first app by yourself.
1. What is Android?
This operation system belongs to Google. Android was born in 2003, was founded by Andy Rubin, and bought by Google 22 months later. Until 2007, Android didn´t appear in markets. The first Nexus device was made by HTC followed by trades like Motorola, Samsung, and LG introducing the next generations of Nexus devices. Nowadays Android is one of the most important OSs and is used by a billion people making it a great idea to develop an application in this OS - maybe your app will be the next Flappy Bird!! If you want to know more information about Android history you can check these links:
2. Android IDE´s
3. Android Activity Lifecycle
The applications in Android run into an activity. An Activity is an application component that provides a screen with which users can interact in order to do something such as dial the phone, take a photo, send an email, or view a map. Each activity is given a window in which to draw its user interface. The window typically fills the screen, but may be smaller than the screen and float on top of other windows. This activity has a lifecycle of states and they are1:
- OnCreate(): Called when the activity is to first create. This is where you should do all of your normal static set up — create views, bind data to lists, and so on.
- Onrestart(): Called after the activity has been stopped, just prior to it being started again.
- OnStart(): Called just before the activity becomes visible to the user.
- OnResume(): Called just before the activity starts interacting with the user. At this point, the activity is at the top of the activity stack with user input going to it.
- OnPause(): Called when the system is about to start resuming another activity. This method is typically used to commit unsaved changes to persistent data, stop animations and other things that may be consuming CPU, and so on. It should do whatever it does very quickly, because the next activity will not be resumed until it returns.
- OnStop(): Called when the activity is no longer visible to the user. This may happen because it is being destroyed, or because another activity (either an existing one or a new one) has been resumed and is covering it.
- OnDestroy(): Called before the activity is destroyed. This is the final call that the activity will receive. It could be called either because the activity is finishing (someone called finish() on it) or because the system is temporarily destroying this instance of the activity to save space.
On the other hand, exiting the activity is associated with an User Interface file - this is called Layout. In the layouts we are going to design the interface and put the text fields and other elements we want to use. Layouts have a lot of parameters, and we will dive more into the details in the next post.
1 Text and image provide by Android