Android Application Development notes

Source: Internet
Author: User

1. A service runs in the main thread of its hosting process-the service does not create
Its own thread and does not run
In a separate process (unless you specify otherwise)

Although the service does not have a UI, it cannot perform time-consuming operations. Otherwise, activitymanager still reports ANR. Even if the service is set to another process, the UI of the current process will not be blocked, however, the log is printed on the background, and the service in another process is about 30 s later than ANR .. And there is no prompt box for ANR to pop up...


2. startactivity

<Activity
Android: Name = "com. example. Call. myactivity"
Android: Label = "@ string/app_name2">
<Intent-filter>
<Action Android: Name = "ritter.com"/>
<Category Android: Name = "android. Intent. Category. Default"/>
</Intent-filter>
</Activity>

When you call an activity implicitly, you must specify the category default in intent-filter, because the default intent creates the category default.

Android treats all implicit intents passed to startactivity () as if they contained at least one category: "android. Intent. Category. Default"
(The category_default constant). Therefore, activities that are willing to receive implicit intents must include "android. Intent. Category. Default" in their intent Filters


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.