怎么在一个APP中调用另外一个APP
2016-06-07 16:26
281 查看
声明:下文中把去调用的APP称谓A,把被调用的APP称谓B。
首先在B中的清单文件中找到A调用时需要进入到的activity,并把在属性中增加:
然后在A中的activity中去调用这个action。
即
如果不需要带参数的话,就不需要加上
改成为<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >。
首先在B中的清单文件中找到A调用时需要进入到的activity,并把在属性中增加:
<pre class="html" name="code"><pre class="html" name="code"><activity android:name="org.ebookdroid.pdfdroid.activity.MainFunctionActivity" android:hardwareAccelerated="true" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar" <span style="color:#ff0000;"><strong>android:exported="true"</strong> </span>> <intent-filter> <action android:name="<strong><span style="color:#ff0000;">com.esa2000.azt.asignon1.startViewer</span></strong>" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
然后在A中的activity中去调用这个action。
即
Intent intent = new Intent("com.esa2000.azt.asignon1.startViewer"); intent.putExtra("name", str1); intent.putExtra("password", str2); startActivity(intent);
如果不需要带参数的话,就不需要加上
intent.putExtra("name", str1);
intent.putExtra("password", str2); 在B的MainFunctionActivity中getIntent()就能获得参数。
另外,如果想在手机桌面只显示A而不显示B,则需要在B的清单文件中把跳入到的activity中属性<category android:name="android.intent.category.LAUNCHER" />给改成<category android:name="android.intent.category.DEFAULT" />。
还有想在同一部手机中既能安装B的本身APP,又能安装A调用的B,则需要把被调用的APP也是B中的包名给改掉。
例如B本身的包名为<manifest xmlns:android="<a target=_blank href="http://schemas.android.com/apk/res/android">http://schemas.android.com/apk/res/android</a>" <strong><span style="color:#ff0000;">package="com.example</span></strong>" android:versionCode="1" android:versionName="1.0" >
改成为<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >。
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析
- android searchView的关闭事件
- SourceProvider.getJniDirectories