失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Android Fundamentals

Android Fundamentals

时间:2022-10-06 04:10:19

相关推荐

Android Fundamentals

当然是google的说明文档最权威了,给出链接:

/guide/topics/fundamentals.html

然后,是我自己的一点感悟:

1.

先上传个经典的架构图

关于这幅图,值得说明的是:

(1)应用开发者主要研究的是application framework这一层,随着google开发ndk开发模式,c/c++程序员可以编写本地库。

对于内核研究人员,当然什么都是没有限制的,移植的主要任务是内核的移植,其他的都是选择性的。

(2) 注意Dalvik Virtual Machine的位置,和libraries属于同一层,但是又用到了c/c++的lib的东西,所以是在lib偏上的位置,

Dalvik虚拟机执行的是.dex格式的字节码,由.class格式转化而来,如果要做破解,有逆向进行转换的工具。

2.

直接引用google的一点说明

The Android operating system is a multi-user Linux system in which each application is a different user.By default, the system assigns each application a unique Linux user ID (the ID is used only by the system and is unknown to the application). The system sets permissions for all the files in an application so that only the user ID assigned to that application can access them.Each process has its own virtual machine (VM), so an application's code runs in isolation from other applications.By default, every application runs in its own Linux process. Android starts the process when any of the application's components need to be executed, then shuts down the process when it's no longer needed or when the system must recover memory for other applications.

可见android的应用不等于进程,他们各自有自己的生命周期,一个应用相当于一个user,非常便于权限管理。

3.

应用程序主要由四大组件构成,分别是Activities,Services,Content providers,Broadcast receivers。应用组件里除了content providers之外都可以用intent对象激活,

关于intent描述如下:An intent is created with anIntentobject, which defines a message to activate either a specific component or a specifictypeof component—an intent can be either explicit or implicit, respectively.每一个compnent在使用时必须在manifest文件中声明,当然,manifest是非常关键的,他的作用当然不仅仅是声明组件,还有声明权限,apilevel等。

4.

资源文件的管理是非常方便的,只要你加到对应的文件夹下,adt就会自动的扫描,并在R.java文件的类中生成相应的操作句柄,当然这个过程有时候有点慢,clean一下就好了。android应用程序的用户interface

可以用java代码和xml文件声明两种方式方式来进行,google推荐用第二种方式,注意用xml文件声明的方式并不低效,因为在最后发布的.apk程序包中并没用xml文件,adt插件已经将其转化为相应的二进制码。

5 这里仅仅做个入门介绍,限定在某个平台上的应用开发,学习方法还是在熟悉基本框架的基础上多敲代码,多实际做东西。google的帮助文档要常常去查。

如果觉得《Android Fundamentals》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。