第2讲+Android应用程序框架

第2讲+Android应用程序框架

ID:45724647

大小:1.13 MB

页数:40页

时间:2019-11-17

第2讲+Android应用程序框架_第1页
第2讲+Android应用程序框架_第2页
第2讲+Android应用程序框架_第3页
第2讲+Android应用程序框架_第4页
第2讲+Android应用程序框架_第5页
资源描述:

《第2讲+Android应用程序框架》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、嵌入式系统软件开发Android开发技术长沙学院计算机系周景1第2章Android程序设计基础重点:Android程序框架Android生命周期Android程序UI设计目录结构src:开发人员编写的源代码gen:项目自动生成的代码R.java:定义该项目所有资源的索引文件res:资源文件图片,菜单,界面布局,字符串,动画,音频assets:也可以存放资源文件,而且/assets目录下的资源文件不会在R.java自动生成ID,所以读取/assets目录下的文件必须指定文件的路径AndroidManifest.xml:全局数据,包含了该项目使用的Activity、Servi

2、ce、ReceiverAndroid应用解析Android程序组件:Activity(Component)Service(Component)BroadcastReceiver(Component)ContentProviderIntentActivityAnactivityisasingle,focusedthingthattheusercando.手机上的一个屏幕ActivityTakescareofcreatingawindowforyouinwhichyoucanplaceyourUIwithsetContentView(View).theycanalsobeus

3、edinotherways:asfloatingwindows(viaathemewithwindowIsFloatingset)embeddedinsideofanotheractivity(usingActivityGroup).ContentProvider数据存储:SharedPreferences:存储“key-valuepaires”格式的数据,保存为xml文件Files:Linux文件格式SQLite:轻量级的关系数据库Network:通过网络来存储和获得数据ServiceService是一个生命周期长且没有用户界面的程序。ActivityLifeCycle

4、RunningIfanactivityintheforegroundofthescreen(atthetopofthestack),itisactiveorrunning.当Activity在前台显示的时候,Activity处于active状态或者running状态pausedIfanactivityhaslostfocusbutisstillvisible(thatis,anewnon-full-sizedortransparentactivityhasfocusontopofyouractivity),itispaused.当一个Activity失去焦点仍然可见时,该

5、Activity处于暂停状态(那意味着一个新的不是全屏的或者透明的Activity在这个Activity前面并获得了焦点。),Apausedactivityiscompletelyalive(itmaintainsallstateandmemberinformationandremainsattachedtothewindowmanager),butcanbekilledbythesysteminextremelowmemorysituations.stoppedIfanactivityiscompletelyobscuredbyanotheractivity,itiss

6、topped.Itstillretainsallstateandmemberinformation,however,itisnolongervisibletotheusersoitswindowishiddenanditwilloftenbekilledbythesystemwhenmemoryisneededelsewhere.ShutdownIfanactivityispausedorstopped,thesystemcandroptheactivityfrommemorybyeitheraskingittofinish,orsimplykillingitsproce

7、ss.Whenitisdisplayedagaintotheuser,itmustbecompletelyrestartedandrestoredtoitspreviousstate.Asummaryoftheactivitylifecycle'scallbackmethodsIntentAnintentisanabstractdescriptionofanoperationtobeperformed.Intent是要执行的操作的一种抽象描述,这里的“操作”主要用来启动下列三种组件:ActivityService.Broadc

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。