Android: not single entry point

本文探讨了Android应用程序如何通过组件化实现资源共享,特别是在不需要整个应用加载的情况下调用特定组件的功能。文章解答了关于如何仅启动目标组件而非整个应用的问题,并讨论了这种方式如何有助于节省手机资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        .....you can call upon that scroller to do the work, rather than develop your own. Your application doesn't incorporate the code of the other application or link to it. Rather, it simply starts up that piece of the other application when the need arises.

        For this to work, the system must be able to start an application process when any part of it is needed, and instantiate the Java objects for that part. Therefore, unlike applications on most other systems, Android applications don't have a single entry point for everything in the application (no main() function, for example).

 

    上面这段话是android dev guide文档中的一段,具体url是:http://androidappdocs.appspot.com/guide/topics/fundamentals.html

 

    关于这段有如下几个疑问:

                   1, 关于“ For this to work”中this的理解。 结合上文,我们知道,“this”是指“ it simply starts up that piece of the other application when the need arises”。 也就是说, appR为了用到appA中的scroller, android就只start appA中的scroller了?

 

                   2, 顺着问题1, 往下看,看到“the system must be able to start an application process when any part of it is needed”。 这里的“an application process”并不是“an application”, 也就是说为了appA中的scroller,系统启动一个进程,而这个进行中只有关于scroller的信息, 而不是把整个appA都启动。 这种情况下(进程中只有scroller的信息,而没有启动整个appA), 用户再启动appA,系统再怎么处理scroller?appA跟appR共用一个croller存储空间,这好像不大现实。 操作系统是怎么处理这个问题的?

 

                   3, 这样不只是有一个entry point的设计,是怎么来节省手机资源的?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值