Unit - 5
Unit - 5
s Example:
public class MyReceiver extends BroadcastReceiver
{
public void onReceive(context,intent){}
}
Content Providers
A content provider component supplies data from one
application to others on request.
Such requests are handled by the methods of the
ContentResolver class.
Application The data may be stored in the file system, the
Component database or somewhere else entirely.
s Example:
public class MyContentProvider extends
ContentProvider {
public void onCreate(){}
}
There are additional components which will be used in
the construction of above mentioned entities, their
logic, and wiring between them. They are:
1. Fragments-Represents a portion of user interface
in an Activity.
Additional 2. Views-UI elements that are drawn on-screen
including buttons, lists forms etc.
Componen 3. Layouts-View hierarchies that control screen
ts format and appearance of the views.
4. Intents-Messages wiring components together
5. Resources-External elements, such as strings,
constants and drawable pictures.
6. Manifest-Configuration file for the application.
AndroidManifest.xml contains information of your
package, including components of the application
such as activities, services, broadcast receivers,
content providers etc.
It performs some other tasks also:
1. It is responsible to protect the application to
Android access any protected parts by providing the
Manifest permissions.
2. It also declares the android api that the
File application is going to use.
3. It lists the instrumentation classes. The
instrumentation classes provides profiling and
other information.
This is the required xml file for all the android
application and located inside the root directory
The elements used in the above xml file are described
below:
<manifest>
manifest is the root element of the
Elements AndroidManifest.xml file. It has package attribute
of the that describes the package name of the activity class.
<application>
Android application is the sub element of the manifest. It
Manifest.x includes the namespace declaration.
ml file This element contains several sub elements that
declares the application component such as activity
etc.
The commonly used attributes are of this element are
icon, label, theme etc.
<activity>
activity is the subelement of application and
Elements represents an activity that must be defined in the
of the AndroidManifest.xml file.
It has many attributes such as label, name, theme,
Android launchMode etc.
Manifest.x <intent-filter>
Developme Run
Debug
Shift+F10
Shift+F9
Control+R
Control+D
nt Logcat Alt+6 Command+6
Environmen Return to Editor Esc Esc