android 重要组件之一activity,及进程间的通信
16lz
2021-01-26
activity之间通信方法用Intent。
1,不同的进程间调用,调用时activity要共享
在网上看到的例子说再功能文件中注册一个唯一标示,元素名称是action动作。
拨电话号码的例子调用:
Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("34345551"));
startActivity(intent);
2,同一进程间调用也要在AndroidManifest.xml中注册
<application>
<activity android:name="Appto"></activity>
</application>
调用方法:
Intent intent = new Intent();
intent.setClass(App.this, Appto.class);
startActivity(intent);
App.this.finish();
activity可以方便的管理view,以及view间的切换,开发不用再为view的切换通信专门写控制类。方便。为开发节约时间。
1,不同的进程间调用,调用时activity要共享
在网上看到的例子说再功能文件中注册一个唯一标示,元素名称是action动作。
拨电话号码的例子调用:
Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("34345551"));
startActivity(intent);
2,同一进程间调用也要在AndroidManifest.xml中注册
<application>
<activity android:name="Appto"></activity>
</application>
调用方法:
Intent intent = new Intent();
intent.setClass(App.this, Appto.class);
startActivity(intent);
App.this.finish();
activity可以方便的管理view,以及view间的切换,开发不用再为view的切换通信专门写控制类。方便。为开发节约时间。
更多相关文章
- 【白话】App从启动到页面显示出来发生了什么
- Android(安卓)自定义 dialog
- Android(安卓)Binder 驱动 - 内核驱动层源码分析
- 查看Android设备给每个应用分配的内存大小
- Android(安卓)应用退出后销毁apk进程
- Android(安卓)Banner轮播控件
- android中的dialog
- Android(安卓)Gems — AMS的Service生命周期管理
- Android获得所有存储设备位置的最佳方法