Five tips for Android programming: Activity, service, broadcastreceiver, contentprovider, and intent

Source: Internet
Author: User
Tags php server

When I first started to get started with Android, I had no idea at all. If I started to start with the SDK documentation, where should I start? If you are looking for examples on the Internet, which example should you look for to learn? Both methods are good. At that time, I joined a project and followed the project to drive learning. This is actually a superb method and a quick way to learn. If there is no project, you can set a task and then do it. Don't worry, as long as you can think of it, just do it, even if the website cannot be searched by yourself, it proves that android cannot be done, and many things will be learned, don't believe you can try (like I want to let the camera portrait screen loading, the results prove that it is difficult to do, or even can not do, that is, see: Android camera portrait screen research guide http://hi.baidu.com/juwend/blog/item/9977a8f69dff2229730eec6b.html ).
After a period of study, I have a deeper understanding of Android. We can list the five key classes of Android based on the guidance of the android SDK (Official Website: Android, that is to say, the Android Application Development is roughly divided into five major parts, just as the title of this article is written-activity application activity,
Service background service, broadcastreceiver Broadcast Reception, contentprovider data support (external data), intent (Active Bridge ), I am also grateful for the inspiration from Google Android development getting started and practice (the book is very expensive, the example is more basic, mostly around the SDK, but the code format is not standard, it should be caused by typographical analysis. The most valuable example is the last few projects in the book. I can learn a lot. I am very grateful to the author for providing these things ).
The five key blocks are briefly described below. For details, see their respective documents:
1. Activity: application activity (Official Website: http://developer.android.com/reference/android/app/Activity.html, local: Local SDK/reference/Android/APP/activity.html)
An activity performs almost all the operations on the application. The activity should have a window, which can be changed by theme. You should pay attention to the impact of its lifecycle (lifecycle), device status (configuration) changes, and storage of running status and data, this is critical to the reliability and humanization of an application. Permissions should also be stated in the activity to use some hardware and software features of Android, which can be provided by code or manifest. xml. Finally, each activity must be stated in manifest.
2. Service: Background Service (Official Website: http://developer.android.com/reference/android/app/Service.html, local: Local SDK/reference/Android/APP/service.html)
A service is a program without interfaces. It is a so-called service or a background program. Pay special attention to the relationship between the service start (startservice) and bindservice) methods and the service lifecycle, the life cycle effects of the two account service methods are different. In addition, the permission and service are affirmed in code or manifest.
3. broadcastreceiver: Broadcast receiver (Official Website: http://developer.android.com/reference/android/content/BroadcastReceiver.html, local: Local SDK/reference/Android/content/broadcastreceiver.html)
Broadcast receiving is not generally referred to as radio broadcasting, but an intent sent by sendbroadcast (). That is, the intent is broadcast here, And broadcastreceiver is registered (registe) then, you can automatically monitor the intent that meets the given conditions. If so, the owner of this broadcastreceiver will be notified.
4. contentprovider: data support (external data) (website: http://developer.android.com/reference/android/content/ContentProvider.html, local: Local SDK/reference/Android/content/contentprovider.html)
Contentprovider is used to save application data and establish and maintain the database, so that the program can return to the previous state or save information when restarted. Pay attention to the application permission and SQL language usage. Android uses a lightweight Database System SQLite.
5. intent: intent (activity Bridge) (Official Website: http://developer.android.com/reference/android/content/Intent.html, local: Local SDK/reference/Android/content/intent.html)
Intent is a very important component in Android Application development. Many books explain it in literal translation, which is not very easy to understand. I think it can be translated as "activity bridge", that is, connecting two activities) bridge ). You can use intent to start any activity from one activity, whether defined by yourself or by the system. In the activitygroup (extends activity), the flag setting of intent is crucial to the Startup Mode of the Child Activity.
In my opinion, whether it is learning or development, it is better to start from these five key categories, which is well organized and easy to grasp the key points and avoid problems. Of course, these five categories are only five of the five main categories of Android Application Development. There are also many sub-categories that need to be specially developed. To learn a lot about Android Application Development, it is still necessary to study their sub-aspects.
Note: At the beginning, the project team gave two simple hot questions: first, a simple browser on the Android system, this is actually an example in the SDK documentation Hello view (website: http://developer.android.com/resources/tutorials/views/hello-webview.html, then local address: Local sdkdocsguide)
Utorialsviewshello-webview.html, hello view inside the example can take a good look, very easy to use), at that time did not know, it is still online to find ah, look for ah, the second is to do a simple chat room on the Android system, this involves the server and client problems (PhP service construction visible: apmserv set up PHP server http://hi.baidu.com/juwend/blog/item/48890045925be189b2b7dcb5.html ), the specific reference code of the chat room will be written in future articles.
Five tips for Android programming: Activity, service, broadcastreceiver, contentprovider, and intent -- juwend have limited levels. If there are any errors or omissions, please correct them. You are welcome to repost them and perform CV operations, but I hope to indicate the source. Thank you!

 

References:

Http://bbs.iandroid.cn/android-9510-1-1.html

Related Article

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.