Calls third-party applications in Android applications

Source: Internet
Author: User

Sometimes our applications need to call applications already written by others (provided that they have been installed on the user's mobile phone ). Your application A calls your application B. There are many methods. For example, you can set Intent-filter in the Activity of the called application B, and then use Intent to call it directly. Later I will talk about how to call third-party applications, such as Baidu cloud disk.

To call a third-party application, you need to know two parameters (The AndroidManifest. xml file of a third-party application must be parsed first.):

The package name of a third-party application; the Activity class name in a third-party application (you can select the first Activity to be started based on your needs ).

Then you can call the following code to start a third-party application:

ComponentName componentName = new ComponentName (pkg, cls); Intent intent = new Intent (); intent. setComponent (componentName); startActivity (intent );

Note: To write AndroidManifest. xml file can be used: http://code.google.com/p/xml-apk-parser/



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.