applicationfundamentals——androiddevelopers毕业设计外文资料翻译内容摘要:

ContentResolver object. This leaves a layer of abstraction between the content provider and the ponent requesting information (for security). There are separate methods for activiting each type of ponent: You can start an activity (or give it something new to do) by passing an Intent to startActivity() or startActivityForResult() (when you want the activity to return a result). You can start a service (or give new instructions to an ongoing service) by passing an Intent to startService(). Or you can bind to the service by passing an Intent to bindService(). You can initiate a broadcast by passing an Intent to methods like sendBroadcast(), sendOrderedBroadcast(), or sendStickyBroadcast(). You can perform a query to a content provider by calling query() on 8 a ContentResolver. For more information about using intents, see the Intents and Intent Filters document. More information about activating specific ponents is also provided in the following documents: Activities, Services, BroadcastReceiver and Content Providers. The Manifest File Before the Android system can start an application ponent, the system must know that the ponent exists by reading the application39。 s file (the manifest file). Your application must declare all its ponents in this file, which must be at the root of the application project directory. The manifest does a number of things in addition to declaring the application39。 s ponents, such as: Identify any user permissions the application requires, such as Inter access or readaccess to the user39。 s contacts. Declare the minimum API Level required by the application, based on which APIs the application uses. Declare hardware and software features used or required by the application, such as a camera, bluetooth services, or a multitouch screen. API libraries the application needs to be linked against (other than the Android framework APIs), such as the Google Maps library. Declaring ponent capabilities As discussed above, in Activating Components, you can use an Intent to start activities, services, and broadcast receivers. You can do so by explicitly naming the target ponent (using the ponent class name) in the intent. However, the real power of intents lies in the concept of intent actions. With intent actions, you simply describe the type of action you want to perform (and optionally, the data upon which you’d like to perform the action) and allow the system to find a ponent on 9 the device that can perform the action and start it. If there are multiple ponents that can perform the action described by the intent, then the user selects which one to use. The way the system identifies the ponents that can respond to an intent is by paring the intent received to the intent filters provided in the manifest file of other applications on the device. When you declare a ponent in your application39。 s manifest, you can optionally include intent filters that declare the capabilities of the ponent so it can respond to intents from other applications. You can declare an intent filter for your ponent by adding an intentfilter element as a child of the ponent39。 s declaration element. For example, an application with an activity for posing a new might declare an intent filter in its manifest entry to respond to send intents (in order to send ). An activity in your application can then create an intent with the “send” action ( ACTION_SEND), which the system matches to the application’s “send” activity and launches it when you invoke the intent with startActivity(). For more about creating intent filters, see the Intents and Intent Filters document. Declaring application requirements There are a variety of devices powered by Android and not all of them provide the same features and capabilities. In order to prevent your application from being installed on devices that lack features needed by your application, it39。 s important that you clearly define a profile for the types of devices your application supports by declaring device and software requirements in your manifest file. Most of these declarations are informational only and the system does not read them, but external services such as Android Market do read them in order to provide filtering for users when they search for applications from their device. 10 For example, if your application requires a camera and uses APIs introduced in Android (API Level 7), you should declare these as requirements in your manifest file. That way, devices that do not have a camera and have an Android version lower than cannot install your application from Android Market. However, you can also declare that your applicaiton uses the camera, but does not require it. In that case, your application must perform a check at runtime to determine if the device has a camera and disable any features that use the camera if one is not available. Here are some of the important device characteristics that you should consider as you design and develop your application: Screen size and density In order to categorize devices by their screen type, Android defines two characteristics for each device: screen size (the physical dimensions of the screen) and screen density (the physical density of the pixels on the screen, or dpi— dots per inch). To si。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。