Android Development Framework

Source: Internet
Author: User

Android development Framework includes basic application function development, data storage, network access three chunks.

1 Application aspects
Generally speaking, a standard Android program includes activity, broadcast Intent Receiver, Service, Content Provider
Four parts.
1). Activity
Activity is the most frequent and basic module in Android application development. In Android, Activity classes are primarily related to interface resources
File associated (XML resources in the Res/layout directory or without any interface resources), including the control's display design, interface interaction
Design, incident response design and data processing design, navigation design and other aspects of application design.
Therefore, for an activity, it is an interface on the phone, which is the equivalent of a Web page, and the difference is that each activity
A return value, similar to a function, is returned at the end of the run. The Android system automatically records all jumps from the home page to other pages
Recording and automatically presses the previous activity into the system stack, the user can programmatically delete activity Instance in the history stack.

2). Broadcast Intent Receiver
Intent provides a mechanism for different activity jumps, such as jumping from a activity to B activity, using Intent to achieve,
The statements are as follows.
Intent in = new Intent (a.this, B.class);
StartActivity (in);
Broadcast Intent Receiver provides the possibility for inter-process communication between various Android applications. Like when the phone
When a call arrives, a broadcast message can be published via broadcast Intent Receiver. Users are not able to see broadcast Intent
Receiver event, it is opaque to the user, broadcast Intent receiver notifies the user via notification Manager that this
Events, which can be registered either in resource Androidmanifest.xml or in code through Context.registerreceiver ()
After registering in Androidmanifest.xml, the system automatically starts when an event arrives, even if the program does not start
Use the program. In addition, each application can easily broadcast its own events to other applications via Context.sendbroadcast ()
Order.

3). Service
Service in Android and service in Windows is completely a concept that users can get through StartService (Intent service)
Start a service, or you can bind a service via Context.bindservice.

4). Content Provider
Content Provider provides a mechanism for data exchange between applications, an application that implements a content Provider
The abstract interface exposes its own data, and the specific data storage implementation is concealed, thus enabling the Android application's internal
Confidentiality of the data. The standard content Provider provides a basic crud (Create, Read, Update, Delete) interface, and
And the permission mechanism is implemented to protect the security of data interaction.
The engineering files for a standard Android application contain the following parts.
? Java source code section (contains activity)--placed in the SRC directory.
? R.java files--generated and maintained automatically by eclipse, developers do not need to modify, providing a global index to Android resources.
? Android library--app runs the Android library.
? Assets Directory--used primarily for placing files such as multimedia.
? Res Directory--A resource file is placed: drawable contains a picture file, layout contains layouts files, values
It consists mainly of strings (Strings.xml), colors (colors.xml), and Array (arrays.xml) resources.
? androidmanifest.xml--application configuration file, in this file, you need to declare all the activity, Service,
Receiver and so on.

2 Data storage
The storage methods available in Android include: sharedpreferences, file storage, SQLite database storage, content provider
Ways of content Provider and network mode 5, specifically described below.

1). Sharedpreferences
As a profile read/write method provided by Android, it is saved in the app's directory by default Data/<package name>/shared_prefs
Getsharedpreferences (XX, 0) to get the Sharedpreferences object for read/write operations.
2). File storage
The Android system provides APIs for data read/write access, such as Openfileinput, openfileoutput, etc., requiring special note
This means that the data of the application in Android is private, that is, other applications cannot access the text generated by the current application
Thing
3). How SQLite databases are stored
Database operations are facilitated by inheriting the CRUD interfaces provided by the Sqliteopenhelper class, which facilitates the application's data storage
For
4). Content provider Mode (contents Provider)
Read/write access to data is achieved by invoking the data interfaces of other applications.
5). Network mode
The Network Service interface provided by the network is accessed mainly through the following network to realize the data read/write service (such as WebService
Data access interface).

Network access aspects

Android primarily uses java.net.* and android.net.* to encapsulate HTTP access technology, leveraging its httppost,
Defaulthttpclient, HttpResponse, and other classes provide access to specific Web services.

Android Development Framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.