When you start with a new technology you are exited to do your first application, I know your fidget because I pass through this lap several times.
unfortunately, when you start developing Android you should know the basic concepts which I try t explain it through this post.
Android application is composed by some “key classes”, these classes are the bricks to help developer building the application. So, developing Android application
must be preceded by discovering Android’s brick. Let’s start :
- Activity :
The Activity concept is based on user interaction notion. Activity represents the window or simply the screen which will be shown to the user.
IT also allows to manage some features such as pressing the [MENU] key or the display warning messages (Toast)
According to this declaration, each user interface in the application is an Activity, so the Java class must extend the Activity class.
- View :
Views is the basic constituents(components) of the graphic interface. They allow to build the user interface.
Widgets, graphic constituents(components) or other layout inherit in fact from this elementary class.
The depiction / drawing of View is made through Canvas (that we can assimilate to a transparent sheet(leaf) on which we draw with a pencil (Paint).
The view is the main component which takes care with managing the users actions (touch the screen, press the keyboard, etc.)
Pay attention to not confuse the concept of Activity and View.
- Intent :
The Intent is a special object, allowing to pass messages between the application components(Activity, Service…). It’s a mean of communication between these component
The concept of Intent comes from the Android security model. In fact, each Android application is a sandbox, cannot get the data from other applications. To
do that the application must send a message to the target component asking it to accompish a task.
- Service :
The Service concept is a definite advantage over iPhone developing.In fact a Service is program running in background and hasn’t a UI.
The most suitable sample to explain this concept is playing music. To play music do not have a user interface and must run in background allowing other application to run.
- ContentProvider :
The ContentProvider are the data managers. They allow sharing information between applications. Imagine an application that maintains a virtual business cards of a group of people.
These cards usually contain the name and a personal contact. Such a program can be created as ContentProvider enabling it to provide other applications on the system information about a person. A third application for sending email can for example ask what ContentProvider to obtain a contact email address.
- BroadcastReceiver :
Finally, a BroadcastReceiver is an application that is listening to other applications. This type of application is trying to respond to the Intent which it is addressed.
There is therefore nothing other than listening to the Intents sent by other application components’.
You know now the different elements used in an Android application.