当前位置:网站首页>Component based learning (1) idea and Implementation
Component based learning (1) idea and Implementation
2022-04-23 07:12:00 【Drink dichlorvos alone】
1. Introduction to componentization
I think componentization , The whole project consists of app Shell , Several business components , And common basic components . As shown in the figure

I think the most obvious feature of componentization is : There is no direct horizontal dependency between business modules .
significance : Don't depend on each other , But they can interact with each other ; Highly decoupled ; Free disassembly
2. Componentized deployment
About how to componentize the project , There are a lot of learning resources on the Internet , I recommend an article , It's super detailed : This is the article
3. Communication between components :
Of course, the most commonly used is Alibaba open source ARouter. I won't introduce more about this , But in addition to this way , There are several other more primitive ways
① Use EventBus
shortcoming :EventBus Maintenance costs are high , Poor management
② Use radio
shortcoming : Broadcasting is not easy to manage , Once the message is not handled , The unification was sent out
③ Use implicit intent
shortcoming : stay AndroidManifest.xml It's configured inside xml That's too much
④ Use class loading
shortcoming : It is easy to write wrong package name and class name
principle : become involved apk When the package , It opens at dex file , Find that the modules are together , Pictured 
So this is the inspiration of this kind of loading method
⑤ Use global Map( Low profile version ARouter)
shortcoming : To register a lot of objects .
every last Activity At the time of creation , To the overall situation Map Register inside . When you need to jump , From this overall situation Map Internal basis key Go and get the corresponding Activity object , This completes the communication
版权声明
本文为[Drink dichlorvos alone]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230606380329.html
边栏推荐
猜你喜欢
随机推荐
双指针仪表盘读数(一)
【2021年新书推荐】Professional Azure SQL Managed Database Administration
iTOP4412 HDMI显示(4.0.3_r1)
Oracle Job定时任务的使用详解
iTOP4412 LCD背光驱动(PWM)
Tiny4412 HDMI显示
同时解决高度塌陷和外边距重叠问题
iTOP4412 HDMI显示(4.4.4_r1)
Oracle和mysql批量查询用户下所有表名和表名注释
Itop4412 cannot display boot animation (4.0.3_r1)
BottomSheetDialogFragment 与 ListView RecyclerView ScrollView 滑动冲突问题
组件化学习(3)ARouter中的Path和Group注解
oracle对表字段的修改
Itop4412 LCD backlight drive (PWM)
Itop4412 HDMI display (4.4.4_r1)
oracle 修改默认临时表空间
Abnormal record-20
HandlerThread原理和实际应用
发布自定义插件到本地服务器
Abnormal record-16









