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/