Android Develop API 1

本文详细阐述了Android操作系统的基本架构、用户权限管理、应用安装流程及组件功能,包括Activity、Service、Contentprovider和Broadcastreceivers等核心组件的生命周期回调方法。强调了不同组件之间的交互与数据共享机制,以及如何在不同设备方向改变时保持应用的流畅运行。
任何资料在官方文档面前都逊色啊。算是中文的总结吧,对Android Develop API 可以对着看,大家交换下意见,错误请务必指正。 
Android应用
  • .Android是基于Linux内核的多用户操作系统,默认会给每一个应用分配唯一的User ID,并为该应用所有的文件赋予基于此User ID的访问限制(应该是沿用linux自身基于用户的权限管理实现)
  • Android应用以独立的linux进程执行,拥有自己的虚拟机。
  • 不同的应用可以共用一个User Id,相互共享文件或者是共用进程和虚拟机(使用相同证书的情况下)--没实践过
  • 应用安装时必须让用户赋予访问资源的权限,比如相机,通讯录。
Android组件
Activity
用户界面 
Service
后台服务
Content provider
应用共享数据 
Broadcast receivers
系统级别广播
 
  AndroidManifest.xml位于应用根目录
声明应用组件
声明应用依赖
声明组件功能
 
Activity

Table 1. A summary of the activity lifecycle's callback methods.

MethodDescriptionKillable after?Next
onCreate()Called when the activity is first created. This is where you should do all of your normal static set up — create views, bind data to lists, and so on. This method is passed a Bundle object containing the activity's previous state, if that state was captured (see Saving Activity State, later).

Always followed by onStart().

NoonStart()
 onRestart()Called after the activity has been stopped, just prior to it being started again.

Always followed by onStart()

NoonStart()
onStart()Called just before the activity becomes visible to the user.

Followed by onResume() if the activity comes to the foreground, or onStop() if it becomes hidden.

No onResume() 
or
onStop()
 onResume()Called just before the activity starts interacting with the user. At this point the activity is at the top of the activity stack, with user input going to it.

Always followed by onPause().

NoonPause()
onPause()Called when the system is about to start resuming another activity. This method is typically used to commit unsaved changes to persistent data, stop animations and other things that may be consuming CPU, and so on. It should do whatever it does very quickly, because the next activity will not be resumed until it returns.

Followed either by onResume() if the activity returns back to the front, or by onStop() if it becomes invisible to the user.

Yes onResume() 
or
onStop()
onStop()Called when the activity is no longer visible to the user. This may happen because it is being destroyed, or because another activity (either an existing one or a new one) has been resumed and is covering it.

Followed either by onRestart() if the activity is coming back to interact with the user, or byonDestroy() if this activity is going away.

Yes onRestart()
or
onDestroy()
onDestroy()Called before the activity is destroyed. This is the final call that the activity will receive. It could be called either because the activity is finishing (someone called finish() on it), or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method.Yesnothing
 
ActivityA 启动ActivtyB时,两个activty都经历状态转换,当A与B需要数据交互需要注意调用时序列。
ActivityA.onPause() ->ActivityB.onCreate()-> ActivityB.onStart()->ActivityB.onResume->ActivityA.onStop()
系统将会保存stop的activity至堆栈,Back Button按下之后会弹出上一个Activty。
当activity的手机方向改变时系统会destroy并create。这时onRestoreInstanceSate()跟onStoreInstanceState()方法就会被调用,默认实现是保存当前的view状态,如果希望不同手机方向有不同的布局,需要自己保存View的状态。
android系统通过intent在不同组件之间相互调用。
android允许activityA启动其他应用的activtyB(通过进程间通信的binder机制),但是是通过向系统发布intent调用消息来实现的,activtyB运行在B进程,通过intent返回数据。
【无人机】基于改进粒子群算法的无人机路径规划研究[和遗传算法、粒子群算法进行比较](Matlab代码实现)内容概要:本文围绕基于改进粒子群算法的无人机路径规划展开研究,重点探讨了在复杂环境中利用改进粒子群算法(PSO)实现无人机三维路径规划的方法,并将其与遗传算法(GA)、标准粒子群算法等传统优化算法进行对比分析。研究内容涵盖路径规划的多目标优化、避障策略、航路点约束以及算法收敛性和寻优能力的评估,所有实验均通过Matlab代码实现,提供了完整的仿真验证流程。文章还提到了多种智能优化算法在无人机路径规划中的应用比较,突出了改进PSO在收敛速度和全局寻优方面的优势。; 适合人群:具备一定Matlab编程基础和优化算法知识的研究生、科研人员及从事无人机路径规划、智能优化算法研究的相关技术人员。; 使用场景及目标:①用于无人机在复杂地形或动态环境下的三维路径规划仿真研究;②比较不同智能优化算法(如PSO、GA、蚁群算法、RRT等)在路径规划中的性能差异;③为多目标优化问题提供算法选型和改进思路。; 阅读建议:建议读者结合文中提供的Matlab代码进行实践操作,重点关注算法的参数设置、适应度函数设计及路径约束处理方式,同时可参考文中提到的多种算法对比思路,拓展到其他智能优化算法的研究与改进中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值