Android资料
- 格式:docx
- 大小:47.02 KB
- 文档页数:10
dm37xx android2.3.4增加recovery升级功能(一)—代码修改今天在给TI omap3的android系统增加recovery模式升级功能时发现,这部分TI根本没有做,只能自己来处理了,参照以前freescale i.mx53平台的做法,分别修改bootloader 及recovery包,现在将工作过程记录如下:1、bootloader部分修改1.1、增加cache及recovery分区/* Initialize the name of fastboot flash name mappings */fastboot_ptentry ptn[] = {{.name = "xloader",.start = 0x0000000,.length = 0x0020000,/* Written into the first 4 0x20000 blocksUse HW ECC */.flags = FASTBOOT_PTENTRY_FLAGS_WRITE_I |FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC |FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_2 |FASTBOOT_PTENTRY_FLAGS_REPEAT_4,},{.name = "bootloader",.start = 0x0080000,.length = 0x01C0000,/* Skip bad blocks on writeUse HW ECC */.flags = FASTBOOT_PTENTRY_FLAGS_WRITE_I |FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC |FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_2,},{.name = "environment",.start = SMNAND_ENV_OFFSET, /* set in config file */.length = 0x0040000,.flags = FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC |FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_1 |FASTBOOT_PTENTRY_FLAGS_WRITE_ENV,},{.name = "kernel",/* Test with start close to bad blockThe is dependent on the individual board.Change to what is required *//* .start = 0x0a00000, *//* The real start */.start = 0x0280000,.length = 0x0500000,.flags = FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC | FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_1 | FASTBOOT_PTENTRY_FLAGS_WRITE_I,},{.name = "cache",/* Test with start close to bad blockThe is dependent on the individual board.Change to what is required *//* .start = 0x0a00000, *//* The real start */.start = 0x00780000,.length = 0x0100000,.flags = FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC | FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_1 | FASTBOOT_PTENTRY_FLAGS_WRITE_I,},{.name = "recovery",/* Test with start close to bad blockThe is dependent on the individual board.Change to what is required *//* .start = 0x0a00000, *//* The real start */.start = 0x00880000,.length = 0x06400000, //100MiB 这里经修改,为什么要修改成这样,在后面将会说明.flags= FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC |FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_1 |FASTBOOT_PTENTRY_FLAGS_WRITE_I,},{.name = "system",.start = 0x06C80000,.length = 0x10000000,.flags = FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC |FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_1 |FASTBOOT_PTENTRY_FLAGS_WRITE_I,},};注意这里的start及length之间的关系,length一定要比所将要刷入该分区的img文件大,编译后我的recovery.img大小为2.3M左右,这里我分区了recovery分区5M的大小。
个人简历姓名:XXX电话:1384385438邮箱:1384385438@个人简历个人基本资料:姓名:XXX 性别:男籍贯:XX省·XX县民族:汉邮箱1384385438@联系电话:1384385438QQ号码:1384385438求职意向:工作类型:全职单位性质:不限期望行业:计算机业期望职位:Android应用开发、Java程序员工作地点:XXX专业技能:熟练掌握Android编程和调试流程,能独立开发Android项目;熟练Android的四大组件:activity、service、contentProvider、brostcastReceiver;熟练掌握Android的五大布局:线性、相对、帧、绝对、表格;熟悉自定义控件;熟练掌握I/O流、多线程、网络进行编程;熟悉SQLite,MySql等数据储存;能够熟练的应用Photoshop处理图片,Office系列基本操作、AutoCAD等。
项目经验:项目一:乐播项目概述:基于Android四大核心组件,实现音乐的简单播放项目功能:从系统媒体库获得音乐信息,并实现随机播放功能,播放中可暂停,显示播放进度,随机选择下一首等功能。
项目技术:1.系统通过Service组件技术启动异步任务,在工作线程中借助ContentProvider对象读取本地媒体库,并将读取的媒体信息借助回调技术返回给service.2.实现对音乐的播放,暂停,随机选择下一首等功能。
3.系统通过Notification技术发送通知,在通知栏实现音乐的播放,暂停控制等功能。
4.系统通过BroadCastReceiver广播技术,在音乐播放的过程中,不断地发送广播,更新SeekBar进度。
项目二:XXX订票系统项目概述:基于AndroidUI实现XXX订票原型设计。
项目功能:实现了用户注册,登录,主页设置,航班查询,航班列表,订单列表等页面的UI设计项目技术:1.借助ViewPager+Fragment+ListView+ActionBar 实现航班列表页面数据展示。
四大主流-手机APP系统简介目录-1-Android系统-2-iOS系统-Vindows Phone7系统-3-Symbian系统-4Android系统-简介-1-开发商-发行时间-Google/开放-2019年9月23-手持设备联盟-日-程语言-源码模式-C/C++底层-混合(自由免费-Java等(应用层)-开放源码概述-Android是一种以Linuxi为基础的开放源码操作系统,主要使用-于便携设备。
目前尚未有统一中文称,中国大陆地区较多人使用安-卓(非官方)或安致(官方)。
Android操作系统最初由Andy-Rubin开发,最初主要支持手机。
2019年由Google!收购注资,并组-建开放手机联盟开发改良,逐渐扩展到平板电及其他领域上。
-Android的主要竞争对手是苹果公司的iOS以及RIM的Blackberry OS。
-219年第一季度,Android在全球的市场份额首次超过塞班系统,跃-居全球第一。
2019年11月数据,Anroid占据全球智能手机操作系-统市场52.5%的份额,中国市场占有率为58%。
android手机-索爱-主要厂商-motorola-htc-三星编程语言-C语言,C++,-Objective-C-开发商-苹果公-ios-司-ios系统-简介-源码模式内核-授权条款-混合(封闭源码,-开源组件-Darwin-EULA商业专有、概述-iOS是由苹果公司开发的手持设备操作-iOS越狱-系统。
苹果公司最早于2019年1月9日的-iOS越就是解除一些-Macworld大会上公布这个系统,最初-原版固件的限制,最大的好-是设计给iPhone使用,后来陆续套用-处是可以安装破解的软件-到iPod touch、iPad以及Apple TVa等-这些软件是收费的,比如-苹果产品上。
iOS与苹果的Mac OS X操-些游戏和实用程序。
越狱-作系统一样,它也是以arwin为基础的,-后还可以对系统主题进行更-因比同样属于类Unix的商业操作系统。
Android Work Profile(工作资料夹)是Android系统中针对企业级设备管理的一项功能,它允许用户在个人和工作之间进行数据与应用的隔离。
这项功能自Android 5.0 Lollipop开始引入,并随着企业移动化管理(EMM, Enterprise Mobility Management)解决方案的演进而不断优化。
原理概述:1.多用户架构扩展: Work Profile基于Android的多用户架构构建,为每个设备上的工作环境创建一个独立的、受管理的用户空间,即“工作模式”。
这样,IT管理员可以控制和配置这个特定的工作空间内的应用、数据、安全策略等,而不会影响到用户的个人资料。
2.容器化:工作资料夹以容器形式存在,这意味着所有安装在工作资料夹中的应用程序及其产生的数据都被严格地与设备的个人资料区分开来。
工作应用的数据存储、权限以及网络访问等都受到单独的政策约束。
3.策略管理: IT管理员通过MDM(移动设备管理)服务器设置并推送策略至Work Profile,这些策略可能包括但不限于应用白名单/黑名单、加密要求、设备锁定规则、网络限制、远程擦除工作数据等。
4.API支持与安全边界: Android系统提供了一系列API和接口供EMM解决方案使用,确保Work Profile能够实现安全的隔离和管理。
例如,系统会在底层对工作和个人应用之间的交互施加限制,保护敏感信息不被未经授权的应用访问。
5.数据加密与认证:默认情况下,工作资料夹中的数据会被加密,并且只有当设备解锁并且连接到公司服务器时,才能访问其中的内容。
这有助于保护公司数据的安全性和隐私性。
6.应用分发与更新: IT管理员可以通过MDM解决方案将工作相关的应用直接推送到员工设备上的Work Profile,这些应用可以独立于个人应用更新和管理。
总结来说,Android Work Profile通过操作系统层面的支持实现了企业对员工设备上工作相关部分的全面管理和安全管控,确保了BYOD(Bring Your Own Device)场景下的企业数据安全及合规性需求。
Android开发简历模板个人信息:姓名:性别:出生日期:联系电话:电子邮箱:所在城市:教育背景:学历,本科/硕士/博士。
就读学校,XXX大学。
专业,计算机科学与技术/软件工程/信息技术等相关专业。
就读时间,XXXX年-XXXX年。
技能专长:精通Java编程语言。
熟悉Android开发框架和常用库。
熟练使用Android Studio进行开发。
掌握面向对象设计和软件工程原理。
具备良好的数据结构和算法基础。
熟悉RESTful API开发和网络通信。
熟悉数据库设计和操作(如SQLite)。
具备良好的团队合作和沟通能力。
项目经验:1. 项目名称,XXX.项目描述,该项目是一个XXX应用,主要实现XXX功能,采用XXX技术栈进行开发。
项目职责,负责XXX模块的设计和开发,与团队成员合作完成XXX功能的实现。
技术亮点,使用XXX框架实现XXX功能,优化了XXX算法,提高了XXX性能。
2. 项目名称,XXX.项目描述,该项目是一个XXX应用,主要实现XXX功能,采用XXX技术栈进行开发。
项目职责,负责XXX模块的设计和开发,与团队成员合作完成XXX功能的实现。
技术亮点,使用XXX框架实现XXX功能,优化了XXX算法,提高了XXX性能。
工作经历:公司名称,XXX公司。
职位,Android开发工程师。
工作时间,XXXX年-XXXX年。
工作职责,负责公司Android应用的开发和维护,与团队成员合作完成产品需求的实现,参与产品的设计和测试工作。
个人项目:个人项目名称,XXX.项目描述,该项目是一个个人开发的XXX应用,主要实现XXX功能,采用XXX技术栈进行开发。
项目职责,负责XXX模块的设计和开发,独立完成XXX功能的实现。
技术亮点,使用XXX框架实现XXX功能,优化了XXX算法,提高了XXX性能。
证书与奖项:获得XXX证书。
获得XXX奖项。
自我评价:具备扎实的Android开发技术和编程基础。
热爱技术,善于学习和探索新的技术。
Android3.0(HoneyComb)新特性调研资料整理一、Fragments(碎片)(一)Fragments要点:a) Fragment表现为一个Activity用户界面的一部分;b) 你可以合并多个fragment在一个单独的activity中;c)也可以在多个activity中重复使用一个F ragment;d) Fragment有自己的生命周期;e)接收自己的输入事件;f)在activity运行的过程中,你可以添加或移除一个Fragment;g) 一个Fragment必须嵌入在一个Activity中使用,Fragment的生命周期由其宿主Activity控制;例如:一个Activity A,含有两个Fragment(F1、F2),当A进入pause()时,F1、F2也都会进入pause()状态;而当A进入destroy状态时,F1、F2也都会进入destroy状态。
但是,当A正在运行时(处于resume状态),可以单独的管理每一个Fragment(F1、F2),比如添加F1或者删除F2。
h) Activity在管理Fragment时是通过FragmentManager和FragmentTransaction 进行的,对Fragment的add()、remove()和replace()的操作都需要在一个Transaction中管理;i)当对Fragment进行操作时,可以把这些操作放在一个由Activity维护的后台堆栈中(Stack),Stack中的每一个元素都是对Fragment进行操作的事务记录;当用户按下回退键(Back)时,可以从Stack中回溯一个事务;j) Fragment可以作为布局(Layout)的一部分添加到Activity中,也可以作为一个没有视图界面的单纯的工作器(Worker)添加到Activity中。
当fragment作为Layout添加时,Fragment就相当于Activity的总体视图系统的一部分,它应当被添加到某一个ViewGroup中。
需求文档阐明书一、前语71.1项目介绍71.2名词解说71.3参阅资料8二、需求概述8三、用户特色83.1用户用例图83.2适用人群9四、假定和束缚8五、需求规矩85.1对功用的规矩85.2对功用的规矩95.3输入输出要求95.3数据办理能力要求95.3毛病处理要求95.3其它专门要求9六、功用结构图96.1功用介绍106.2功用事务总流程图10七、功用需求剖析107.1数据流图107.1.1顶层数据流图107.1.2功用级数据流图127.1.3具体数据流图157.2功用模块187.2.1事务功用描绘187.2.2事务流程图描绘187.2.3相关人物及其履行的活动18 7.2.4流程触及进程阐明187.2.5功用模块流程图197.2.6流程触及相关数据及规矩20八、体系运用的软件与硬件环境阐明428.1核心技能428.2硬件环境与服务器环境:428.3客户端操作体系:42九、原型界面42文档办理信息表主题版本内容规矩了项目事务处理进程和用户要求等信息。
关键字事务流程参阅文档无提交时刻创建人批阅人收效日期文档修正记载表修正人修正时刻修正内容一、前语1.1项目介绍项目称号:目的:缩写词:开发周期:1.2名词解说列出本文件中用到的专门术语的界说和外文首字母组词的原词组。
1.3参阅资料列出用得着的参阅资料,如:a.本项目的经核准的方案任务书或合同、上级机关的批文;b.归于本项目的其他已宣布的文件;本文件中遍地引证的文件、资料、包含所要用到的软件开发规范。
列出这些文件资料的标题、文件编号、宣布日期和出版单位,阐明能够得到这些文件资料的来历。
二、需求概述叙说该项软件开发的目的、运用方针、效果规划以及其他应向读者阐明的有关该软件开发的布景资料。
解说被开发软件与其他有关软件之间的联络。
假如本软件产品是一项独立的软件,而且全部内容自含,则阐明这一点。
假如所界说的产品是一个更大的体系的一个组成部分,则应阐明本产品与该体系中其他各组成部分之间的联络,为此可运用一张方框图来阐明该体系的组成和本产品同其他各部分的联络和接口。
android 源码编译原理(一)Android源码编译本文将以浅入深的方式解释Android源码编译的相关原理。
为什么需要编译Android源码?在Android应用开发中,我们通常使用Android SDK提供的API来开发应用程序。
然而,有时候我们需要对Android系统进行修改或扩展,这就需要我们直接修改Android源代码。
为了让这些修改生效,我们需要将修改后的源码编译成可执行的Android系统镜像,然后将该镜像刷入设备。
编译环境的准备在编译Android源码之前,我们需要准备编译环境。
首先,确保我们的电脑上已经安装了必要的开发工具,如JDK、Python、Git等。
然后,下载Android源码,并进行必要的配置。
要编译Android源码,我们需要使用Linux环境。
如果我们使用的是Windows操作系统,可以通过安装虚拟机或使用Docker等方式创建一个Linux环境。
编译Android源码的基本步骤编译Android源码的基本步骤如下:1.初始化编译环境:在Android源码根目录下执行source build/envsetup.sh命令,初始化编译环境。
2.选择编译目标:执行lunch命令,选择我们要编译的目标设备和版本号。
3.开始编译:执行make命令,开始编译Android源码。
编译过程通常需要较长的时间,这取决于电脑性能和代码的规模。
4.生成镜像:编译完成后,我们可以在out/target/product目录下找到生成的Android系统镜像文件。
深入了解Android源码编译编译Android源码并不仅仅是简单执行几个命令那么简单,背后涉及到了诸多复杂的过程和原理。
下面简单介绍一些主要的原理:1. Android.mk文件在进行Android源码编译时,系统会通过读取每个模块下的Android.mk文件来确定编译的方式和依赖关系。
Android.mk文件是GNU make的一个Makefile脚本,用于描述模块的编译规则、依赖关系和生成产物等信息。
展讯android软件平台基础(for SC8810)目录1.Android基本概念 (2)2.开发环境搭建 (4)安装ubuntu操作系统 (4)设定安装源 (4)安装开发包 (5)展开IDH包 (5)3.代码目录结构 (6)4.编译方法和系统 (7)5.烧录image方法 (8)传统烧录方法 (8)fastboot烧录方法 (8)6.adb (9)7.Log系统 (11)8.Q&A (12)1.Android基本概念Software stack for mobile devices, including operating system, middleware and key applications.2.开发环境搭建安装ubuntu操作系统设定安装源$ sudo vi /etc/apt/sources.listubuntu-10.4:deb /ubuntu/ lucid main multiverse restricted universedeb /ubuntu/ lucid-backports main multiverse restricted universedeb /ubuntu/ lucid-proposed main multiverse restricted universedeb /ubuntu/ lucid-security main multiverse restricted universedeb /ubuntu/ lucid-updates main multiverse restricted universedeb-src /ubuntu/ lucid main multiverse restricted universedeb-src /ubuntu/ lucid-backports main multiverse restricted universe deb-src /ubuntu/ lucid-proposed main multiverse restricted universe deb-src /ubuntu/ lucid-security main multiverse restricted universedeb-src /ubuntu/ lucid-updates main multiverse restricted universe ubuntu-10.10:deb /ubuntu maverick partnerdeb-src /ubuntu maverick partnerdeb /ubuntu maverick maindeb-src /ubuntu maverick maindeb /ubuntu/ maverick main restricted universe multiversedeb /ubuntu/ maverick-backports restricted universe multiversedeb /ubuntu/ maverick-proposed main restricted universe multiverse deb /ubuntu/ maverick-security main restricted universe multiversedeb /ubuntu/ maverick-updates main restricted universe multiversedeb-src /ubuntu/ maverick main restricted universe multiversedeb-src /ubuntu/ maverick-backports main restricted universe multiverse deb-src /ubuntu/ maverick-proposed main restricted universe multiverse deb-src /ubuntu/ maverick-security main restricted universe multiverse deb-src /ubuntu/ maverick-updates main restricted universe multiverse安装开发包更新了安装源之后,需要执行下面的命令安装必要的包$ sudo apt-get update$ sudo apt-get upgrade$ sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind eclipse vim ssh git libodbcinstq1c2 odbcinst1debian1展开IDH包3.代码目录结构最外层目录android:-- Makefile (全局的Makefile,里面只包含build/core/main.mk)-- 3rdparty (包含编译脚本,工具,第三方driver, hal, app,binary)-- bionic (bionic C库,bionic含义为仿生,这里面是一些基础的库的源代码)-- bootable (启动引导相关代码)-- build (存放系统编译规则及generic等基础开发包配置、脚本工具)-- cts (Android兼容性测试套件标准)-- dalvik (Dalvik JA VA虚拟机)-- development (应用程序开发相关,需要的模板和工具)-- device (设备厂商的示例文件)-- external (Android使用的一些开源的模组)-- frameworks (核心框架层——java及C++语言)-- hardware (部分厂家开源的硬解适配层HAL代码)-- kernel (Linux内核)-- ndk (一系列工具合集,帮助开发者快速开发C/C++动态库)-- out (编译完成后的代码输出与此目录)-- packages (应用程序包)-- prebuilt (x86和arm架构下预编译的一些资源)-- sdk (Android sdk及模拟器)-- system (Android底层文件系统库、应用及组件——C语言)-- u-boot (Bootloader,引导加载器)-- vendor (厂商定制代码)4.编译方法和系统$ cd 3rdparty/$ ./build.products.sh00). sp8810gaExample:*1* ./build.products.sh sp8810ga2 ./build.products.sh s p8810ga [subcmd]3 jobs=16 ./build.products.sh sp8810ga++++++++++++++++++++++++++ subcmd list ++++++++++++++++++++++++++prebuild [dirname] -- 编译android工程时脚本会将第3方chip的修改动态patch到android工程中lbuild [dirname] [clean] -- 调用第3方build.sh脚本中的function my_local_build函数(主要用来编译ko)nbuild -- 只编译标准androidfprebuild -- 快速build需要的前提配置自动设置,同时完成一次彻底编译(建议使用)fbuild -- 快速build,不编译3rdparty下的ko(一旦repo sync,务必重新执行fprebuild)fbuild2 -- 快速build,在fbuild基础上,再额外编译3rdparty下的文件(建议使用)clean -- 清除第3方对android的所有修改,恢复到原始的android版本,可以认为是unpatch.diff [dirname] -- 比较第3方代码和android标准代码的差异,即生成patchdiff2 [dirname] -- 用beyondcompare比较第3方代码和android标准代码的差异install [dirname] -- 将第3方编译结果安装到out/target/product/xxxx/system/sps*目录install2 [outdir ] -- 将product产品编译结果安装到outdir目录(用来在批量编译产品时完成自动拷贝)ramdisk -- 编译product产品对应的ramdisk.img,将init.3rdparty.rc修改内容添加到ramdisk.imgrecovery -- 编译product产品对应的ramdisk-recovery.img和recovery.img system -- 重新打包system文件夹生成system.imguserdata -- 重新打包data文件夹生成userdata.imgbootimage -- 生成boot.img和linux.bin内核文件bootimage2 -- 先删除.config,然后编译整个内核,最后生成boot.img和linux.bin 内核文件5.烧录image方法编译之后产生的image目录在:Out/target/product/hsdroid/sps.images.sp8810ga/可以看到,idh包编译出来的需要烧录的image是:fdl2.bin, u-boot-spl-16k.bin, u-boot.bin,boot.img, system.img, userdata.img, recovery.img另外,展讯还会release modem image:Vmjaluna.img, DSP.bin, nvitem.bin, Modem.bin传统烧录方法使用research downloader, upgrade downloader, factory downloader, 烧录上面所有的image。
一、单项选择题1、以下哪个控件可以用来显示图片( )A. ImageViewB. TextViewC. ButtonD. 以上都可以2、Android开发中常用的数据库是( )A. SQL ServerB. MySQLC. SQLiteD. Oracle3、在 android 中使用 SQLiteOpenHelper 这个类时,可以获取数据库并可以对数据库进行读写的方法是 ( )A. getWriteableDatabase()B. getReadableDatabase()C. getDatabase()D. getAbleDatabase()4、 Android 项目工程下面的 values 目录的作用是什么 ( )A. 放置应用到的图片资源。
B. 放置字符串,颜色,数组等常量数据C. 主要放置多媒体等数据文件D.放置一些与 UI 相应的布局文件,都是 xml 文件5、如果将一个 TextView 的 android:layout_width 属性值设置为 match_parent ,那么该组件将是以下哪种显示效果? ( )A.该文本域的宽度将填充父容器宽度B.该文本域的宽度仅占据该组件的实际宽度C.该文本域的高度将填充父容器高度D.该文本域的高度仅占据该组件的实际高度6、关于 AndroidManifest.xml 文件,以下描述错误的选项有哪些? ( )A.在所有的元素中只有 <manifest> 和 <application> 是必需的,且只能出现一次B.处于同一层次的元素,不能随意打乱顺序C.元素属性一般都是可选的,但是有些属性是必须设置的D.对可选的属性,即使不写,也有默认的数值项说明7、以下属性中哪个属性是LinearLayout拥有但RelativeLayout没有的属性()A. android:layout_widthB. android:layout_heightC. android:layout_weightD.android:background8、针对ListView组件描述错误的是()A. ListView自带滚动面板功能,如果数据超出屏幕范围,可以自动滚动B. ListView在使用时,一般通过Adapter来加入数据C. ListView如果想改变显示内容,只需要调整对应的List集合中的数据即可D. ListView中可以通过OnItemClickListener来完成针对某一项目的点击监听9、Android在退出程序时,想保存一些信息,可以在哪个方法中完成?( )A. onCreate( )B. onStart( )C. onStop( )D. onDestory( )10、以下调整宽度和高度的属性值,哪个不是Android系统提供的?( )A. Match_parentB. Wrap_contentC. Fill_contentD. Fill_parent11、从其他应用中查询读取内容提供者共享的数据,需要用到的是query方法,返回Cursor 数据,那么这个方法是哪个类对象的方法?( )A . ContentProvider B. ContentResolverC. SQLiteOpenHelperD. SQLiteDataBase12、下面退出 Activity 错误的方法是 ( )A. finish()B. 抛异常强制退出C. System.exit()D. onStop()13、android 系统安装软件格式是( )A. PXLB. SISC. APKD. DA14、在 Android 应用程序中,图片文件应放在那个目录下? ( )A. rawB. ValuesC. layoutD. drawable15、在 AndroidManifest.xml 中描述一个 Activity 时,该 Activity 的 icon 属性是指定什么的? ( )A.指定该 Activity 的图标B.指定该 Activity 的显示标签C.指定该 Activity 和类相关联的类名D.指定该 Activity 的唯一标示16、下列不属于Android布局的是( )A. LinearLayoutB. RelativeLayoutC. AnnotationLayoutD. FrameLayout17、Android项目中assets目录的作用是 ( )A.放置界面布局配置B.放置较大的文件资源C.放置图片资源D.放置界面布局配置18、数据源如果为sqlite数据库中查出的信息最适合的适配器为( )A. SimpleAdapterB. SimpleCursorAdapterC. ArrayAdapterD. ListAdapter19、以下哪个控件可以用来实现星级评分( )A. SeekBarB. ProgressBarC. RatingBarD. ActionBar20、以下哪个控件可以用来实现复选( )A. RadioButtonB. RadioGroupC. CheckBoxD. Spinner21、 Android 项目工程下面的 layout 目录的作用是什么 ( )A. 放置应用到的图片资源。
SHOW MORE IN THIS DOCUMENT Update your target API level User InterfaceNotificationsGraphicsMedia StorageWireless and Connectivity Project VoltaAndroid in the Workplaceand in EducationSystemPrinting FrameworkTesting & Accessibility IMEManifest DeclarationsAPI DIFFERENCESAPI level 20 to 21 »L Developer Preview to 21 »SEE ALSOAndroid 5.0 Behavior ChangesAndroid Lollipop Highlights Android 5.0 APIsAPI Level: 21Android 5.0 (LOLLIPOP(/reference/android/os/Build.VERSION_CODES.html#LOLLIPOP)) offers new features for users and app developers. This document provides an introduction to the most notable new APIs.If you have a published app, make sure to check out the Android 5.0 Behavior Changes (/about/versions/android-5.0-changes.html) that you should account for in your app. These behavior changes may affect your app on Android 5.0devices, even if you are not using new APIs or targeting new functionality.For a high-level look at the new platform features, instead see the Android Lollipop highlights (/about/versions/lollipop.html).Start developing To start building apps for Android 5.0, you must first get the Android SDK (/sdk/index.html). Then use the SDK Manager (/tools/help/sdk-manager.html) to download the Android 5.0 SDK Platform and System Images.To test your apps on a real device, flash a Nexus 5 or Nexus 7 with the ANDROID PREVIEW SYSTEM IMAGE (/preview/index.html#Start).Update your target API levelTo better optimize your app for devices running Android 5.0, set your targetSdkVersion (/guide/topics/manifest/uses-sdk-element.html#target) to "21",install your app on an Android 5.0 system image, test it, then publish the updated app with this change.You can use Android 5.0 APIs while also supporting older versions by addingconditions to your code that check for the system API level before executingAPIs not supported by your minSdkVersion (/guide/topics/manifest/uses-sdk-element.html#min). To learn more about maintaining backward compatibility, read Supporting Different Platform Versions (/training/basics/supporting-devices/platforms.html).For more information about how API levels work, read What is API Level? (/guide/topics/manifest/uses-sdk-element.html#ApiLevels)Important behavior changesIf you have previously published an app for Android, be aware that your app might be affected by changes in Android 5.0.Please see Android 5.0 Changes (/about/versions/android-5.0-changes.html) for complete information.User InterfaceMaterial design supportAndroid 5.0 adds support for Android's new material design style. You can create apps with material design that are visually dynamic and have UI element transitions that feel natural to users. This support includes:The material themeView shadowsThe RecyclerView widgetDrawable animation and styling effectsMaterial design animation and activity transition effectsAnimators for view properties based on the state of the viewCustomizable UI widgets and app bars with color palettes that you controlAnimated and non-animated drawables based on XML vector graphicsTo learn more about adding material design functionality to your app, see Material Design (/training/material/index.html).Concurrent documents and activities in the recents screenIn previous releases, the recents screen (/guide/components/recents.html) could only display only one task for each app that the user interacted with most recently. Now your app can open more tasks as needed for additional concurrent activities for documents. This feature facilitates multitasking by letting users quickly switch between individual activities and documents from the recents screen, with a consistent switching experience across all apps. Examples of such concurrent tasks might include open tabs in a web browser app, documents in a productivity app, concurrent matches in a game, or chats in a messaging app. Your app can manage its tasks through the ActivityManager.AppTask(/reference/android/app/ActivityManager.AppTask.html) class.To insert a logical break so that the system treats your activity as a new task, use FLAG_ACTIVITY_NEW_DOCUMENT(/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_DOCUMENT) when launching the activity with startActivity()(/reference/android/app/Activity.html#startActivity(android.content.Intent)). You can also get this behavior by setting the <activity> (/guide/topics/manifest/activity-element.html) element's documentLaunchMode attribute to "intoExisting" or "always" in your manifest.To avoid cluttering the recents screen, you can set the maximum number of tasks from your app that can appear in that screen. To do this, set the <application> (/guide/topics/manifest/application-element.html) attribute android:maxRecents(/reference/android/R.attr.html#maxRecents). The current maximum that can be specified is 50 tasks per user (25 for low RAM devices).Tasks in the recents screen can be set to persist across reboots. To control the persistence behavior, use the android:persistableMode (/reference/android/R.attr.html#persistableMode) attribute. You can also change the visual properties of an activity in the recents screen, such as the activity’s color, label, and icon, by calling the setTaskDescription()(/reference/android/app/Activity.html#setTaskDescription(android.app.ActivityManager.TaskDescription)) method.WebView updatesAndroid 5.0 updates the WebView (/reference/android/webkit/WebView.html) implementation to Chromium M37, bringing security and stability enhancements, as well as bug fixes. The default user-agent string for a WebView(/reference/android/webkit/WebView.html) running on Android 5.0 has been updated to incorporate 37.0.0.0 as the version number.This release introduces the PermissionRequest (/reference/android/webkit/PermissionRequest.html) class, which allows your app to grant the WebView (/reference/android/webkit/WebView.html) permission to access protected resources like the camera and microphone, through web APIs such as getUserMedia() (https:///en-US/docs/NavigatorUserMedia.getUserMedia). Your app must have the appropriate Android permissions for these resources in order to grant the permissions to the WebView (/reference/android/webkit/WebView.html).With the new onShowFileChooser() (/reference/android/webkit/WebChromeClient.html#onShowFileChooser(android.webkit.WebView, android.webkit.ValueCallback<.Uri[]>, android.webkit.WebChromeClient.FileChooserParams)) method, you can now use an input form field in the WebView (/reference/android/webkit/WebView.html), and launch a file chooser to select images and files from the Android device.Additionally, this release brings support for the WebAudio (http://webaudio.github.io/web-audio-api/), WebGL(https:///webgl/), and WebRTC (/) open standards. To learn more about the new features included in this release, see WebView for Android (https:///multidevice/webview/overview). Screen capturing and sharingAndroid 5.0 lets you add screen capturing and screen sharing capabilities to your app with the newandroid.media.projection (/reference/android/media/projection/package-summary.html) APIs. This functionality is useful, for example, if you want to enable screen sharing in a video conferencing app.The new createVirtualDisplay()(/reference/android/media/projection/MediaProjection.html#createVirtualDisplay(ng.String, int, int, int, int, android.view.Surface, android.hardware.display.VirtualDisplay.Callback, android.os.Handler)) method allows your app to capture the contents of the main screen (the default display) into a Surface (/reference/android/view/Surface.html) object, which your app can then send across the network. The API only allows capturing non-secure screen content, and not system audio. To begin screen capturing, your app must first request the user’s permission by launching a screen capture dialog using an Intent (/reference/android/content/Intent.html) obtained through the createScreenCaptureIntent() (/reference/android/media/projection/MediaProjectionManager.html#createScreenCaptureIntent()) method.For an example of how to use the new APIs, see the MediaProjectionDemo class in the sample project.NotificationsLock screen notificationsLock screens in Android 5.0 have the ability to present notifications. Users can choose via Settings whether to allow sensitive notification content to be shown over a secure lock screen.Your app can control the level of detail visible when its notifications are displayed over the secure lock screen. To control the visibility level, call setVisibility() (/reference/android/app/Notification.Builder.html#setVisibility(int)) and specify one of these values:VISIBILITY_PRIVATE: Shows basic information, such as the notification’s icon, but hides the notification’s full content. VISIBILITY_PUBLIC: Shows the notification’s full content.VISIBILITY_SECRET: Shows nothing, excluding even the notification’s icon.When the visibility level is VISIBILITY_PRIVATE (/reference/android/app/Notification.html#VISIBILITY_PRIVATE), you can also provide a redacted version of the notification content that hides personal details. For example, an SMS app might display a notification that shows "You have 3 new text messages" but hides the message content and senders. To provide this alternative notification, first create the replacement notification using Notification.Builder(/reference/android/app/Notification.Builder.html). When you create the private notification object, attach the replacement notification to it through the setPublicVersion()(/reference/android/app/Notification.Builder.html#setPublicVersion(android.app.Notification)) method.Notifications metadataAndroid 5.0 uses metadata associated with your app notifications to sort the notifications more intelligently. To set the metadata, call the following methods in Notification.Builder (/reference/android/app/Notification.Builder.html) when you construct the notification:setCategory(): Tells the system how to handle your app notifications when the device is in priority mode (for example, if a notification represents an incoming call, instant message, or alarm).setPriority(): Marks the notification as more or less important than normal notifications. Notifications with the priority field set to PRIORITY_MAX or PRIORITY_HIGH appear in a small floating window if the notification also has sound or vibration.addPerson(): Enables you to add one or more people who are relevant to a notification. Your app can use this to signal to the system that it should group together notifications from the specified people, or rank notifications from these people as being more important.GraphicsSupport for OpenGL ES 3.1Android 5.0 adds Java interfaces and native support for OpenGL ES 3.1. Key new functionality provided in OpenGL ES 3.1 includes:Compute shadersSeparate shader objectsIndirect draw commandsMultisample and stencil texturesShading language improvementsExtensions for advanced blend modes and debuggingBackward compatibility with OpenGL ES 2.0 and 3.0The Java interface for OpenGL ES 3.1 on Android is provided with GLES31 (/reference/android/opengl/GLES31.html). When using OpenGL ES 3.1, be sure that you declare it in your manifest file with the <uses-feature> (/guide/topics/manifest/uses-feature-element.html) tag and the android:glEsVersion attribute. For example:<manifest><uses-feature android:glEsVersion="0x00030001"/>...</manifest>For more information about using OpenGL ES, including how to check the device’s supported OpenGL ES version at runtime, see the OpenGL ES API guide (/guide/topics/graphics/opengl.html).Android Extension PackIn addition to OpenGL ES 3.1, this release provides an extension pack with Java interfaces and native support for advanced graphics functionality. These extensions are treated as a single package by Android. (If theANDROID_extension_pack_es31a extension is present, your app can assume all extensions in the package are present and enable the shading language features with a single #extension statement.)The extension pack supports:Guaranteed fragment shader support for shader storage buffers, images, and atomics (Fragment shader support is optional in OpenGL ES 3.1.)Tessellation and geometry shadersASTC (LDR) texture compression formatPer-sample interpolation and shadingDifferent blend modes for each color attachment in a frame bufferThe Java interface for the extension pack is provided with GLES31Ext (/reference/android/opengl/GLES31Ext.html). In your app manifest, you can declare that your app must be installed only on devices that support the extension pack. For example:<manifest><uses-feature android:name=“android.hardware.opengles.aep”android:required="true"/>...</manifest>MediaCamera API for advanced camera capabilitiesAndroid 5.0 introduces the new android.hardware.camera2 (/reference/android/hardware/camera2/package-summary.html) API to facilitate fine-grain photo capture and image processing. You can now programmatically access the camera devices available to the system with getCameraIdList() (/reference/android/hardware/camera2/CameraManager.html#getCameraIdList()) and connect to a specific device with openCamera()(/reference/android/hardware/camera2/CameraManager.html#openCamera(ng.String,android.hardware.camera2.CameraDevice.StateCallback, android.os.Handler)). To start capturing images, create a CameraCaptureSession (/reference/android/hardware/camera2/CameraCaptureSession.html) and specify the Surface(/reference/android/view/Surface.html) objects to send captured images. The CameraCaptureSession(/reference/android/hardware/camera2/CameraCaptureSession.html) can be configured to take single shots or multiple images in a burst.To be notified when new images are captured, implement the CameraCaptureSession.CaptureCallback(/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html) listener and set it in your capture request. Now when the system completes the image capture request, your CameraCaptureSession.CaptureCallback(/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html) listener receives a call to onCaptureCompleted()(/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html#onCaptureCompleted(android.hardware.camera2.Cam eraCaptureSession, android.hardware.camera2.CaptureRequest, android.hardware.camera2.TotalCaptureResult)), providing you with the image capture metadata in a CaptureResult (/reference/android/hardware/camera2/CaptureResult.html).The CameraCharacteristics (/reference/android/hardware/camera2/CameraCharacteristics.html) class lets your app detect what camera features are available on a device. The object's INFO_SUPPORTED_HARDWARE_LEVEL(/reference/android/hardware/camera2/CameraCharacteristics.html#INFO_SUPPORTED_HARDWARE_LEVEL) property represents the camera's level of functionality.All devices support at least the INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY hardware level, which has capabilities roughly equivalent to that of the deprecated Camera API.Devices that support the INFO_SUPPORTED_HARDWARE_LEVEL_FULL hardware level are capable of manual control of capture and post-processing, and capturing high-resolution images at high frame rates.To see how to use the updated Camera (/reference/android/hardware/camera2/package-summary.html) API, refer to the Camera2Basic and Camera2Video implementation samples in this release.Audio playbackThis release includes the following changes to AudioTrack (/reference/android/media/AudioTrack.html):Your app can now supply audio data in floating-point format (ENCODING_PCM_FLOAT). This permits greater dynamic range, more consistent precision, and greater headroom. Floating-point arithmetic is especially useful during intermediate calculations. Playback endpoints use integer format for audio data, and with lower bit depth. (In Android 5.0, portions of the internal pipeline are not yet floating point.)Your app can now supply audio data as a ByteBuffer, in the same format as provided by MediaCodec.The WRITE_NON_BLOCKING option can simplify buffering and multithreading for some apps.Media playback controlUse the new notification and media APIs to ensure that the system UI knows about your media playback and can extract and show album art. Controlling media playback across a UI and a service is now easier with the new MediaSession(/reference/android/media/session/MediaSession.html) and MediaController(/reference/android/media/session/MediaController.html) classes.The new MediaSession (/reference/android/media/session/MediaSession.html) class replaces the deprecated RemoteControlClient (/reference/android/media/RemoteControlClient.html) class and provides a single set of callback methods for handling transport controls and media buttons. If your app provides media playback and runs on the Android TV (/tv/index.html) or Wear (/wear/index.html) platform, use the MediaSession(/reference/android/media/session/MediaSession.html) class to handle your transport controls using the same callback methods.You can now build your own media controller app with the new MediaController(/reference/android/media/session/MediaController.html) class. This class provides a thread-safe way to monitor and control media playback from your app's UI process. When creating a controller, specify a MediaSession.Token(/reference/android/media/session/MediaSession.Token.html) object so that your app can interact with the given MediaSession (/reference/android/media/session/MediaSession.html). By using the MediaController.TransportControls(/reference/android/media/session/MediaController.TransportControls.html) methods, you can send commands such as play() (/reference/android/media/session/MediaController.TransportControls.html#play()), stop()(/reference/android/media/session/MediaController.TransportControls.html#stop()), skipToNext()(/reference/android/media/session/MediaController.TransportControls.html#skipToNext()), and setRating()(/reference/android/media/session/MediaController.TransportControls.html#setRating(android.media.Rating)) to control media playback on that session. With the controller, you can also register a MediaController.Callback(/reference/android/media/session/MediaController.Callback.html) object to listen for metadata and state changes on the session.In addition, you can create rich notifications that allow playback control tied to a media session with the new Notification.MediaStyle (/reference/android/app/Notification.MediaStyle.html) class.Media browsingAndroid 5.0 introduces the ability for apps to browse the media content library of another app, through the new android.media.browse (/reference/android/media/browse/package-summary.html) API. To expose the media content in your app, extend the MediaBrowserService (/reference/android/service/media/MediaBrowserService.html) class. Your implementation of MediaBrowserService (/reference/android/service/media/MediaBrowserService.html) should provide access to a MediaSession.Token (/reference/android/media/session/MediaSession.Token.html) so that apps can play media content provided through your service.To interact with a media browser service, use the MediaBrowser (/reference/android/media/browse/MediaBrowser.html) class. Specify the component name for a MediaSession (/reference/android/media/session/MediaSession.html) when you create an MediaBrowser (/reference/android/media/browse/MediaBrowser.html) instance. Using that browser instance, your app can then connect to the associated service and obtain a MediaSession.Token(/reference/android/media/session/MediaSession.Token.html) object to play content exposed through that service. StorageDirectory selectionAndroid 5.0 extends the Storage Access Framework (/guide/topics/providers/document-provider.html) to let users select an entire directory subtree, giving apps read/write access to all contained documents without requiring user confirmation for each item.To select a directory subtree, build and send an OPEN_DOCUMENT_TREE(/reference/android/content/Intent.html#ACTION_OPEN_DOCUMENT_TREE) intent. The system displays all DocumentsProvider(/reference/android/provider/DocumentsProvider.html) instances that support subtree selection, letting the user browse andselect a directory. The returned URI represents access to the selected subtree. You can then use buildChildDocumentsUriUsingTree()(/reference/android/provider/DocumentsContract.html#buildChildDocumentsUriUsingTree(.Uri, ng.String)) and buildDocumentUriUsingTree() (/reference/android/provider/DocumentsContract.html#buildDocumentUriUsingTree(.Uri, ng.String)) along with query() (/reference/android/content/ContentResolver.html#query(.Uri,ng.String[], ng.String, ng.String[], ng.String)) to explore the subtree.The new createDocument()(/reference/android/provider/DocumentsContract.html#createDocument(android.content.ContentResolver, .Uri,ng.String, ng.String)) method lets you create new documents or directories anywhere under the subtree. To manage existing documents, use renameDocument()(/reference/android/provider/DocumentsContract.html#renameDocument(android.content.ContentResolver, .Uri,ng.String)) and deleteDocument()(/reference/android/provider/DocumentsProvider.html#deleteDocument(ng.String)). Check COLUMN_FLAGS(/reference/android/provider/DocumentsContract.Document.html#COLUMN_FLAGS) to verify provider support for these calls before issuing them.If you're implementing a DocumentsProvider (/reference/android/provider/DocumentsProvider.html) and want to support subtree selection, implement isChildDocument()(/reference/android/provider/DocumentsProvider.html#isChildDocument(ng.String, ng.String)) and includeFLAG_SUPPORTS_IS_CHILD (/reference/android/provider/DocumentsContract.Root.html#FLAG_SUPPORTS_IS_CHILD) in yourCOLUMN_FLAGS (/reference/android/provider/DocumentsContract.Root.html#COLUMN_FLAGS).Android 5.0 also introduces new package-specific directories on shared storage where your app can place media files for inclusion in MediaStore (/reference/android/provider/MediaStore.html). The new getExternalMediaDirs()(/reference/android/content/Context.html#getExternalMediaDirs()) returns paths to these directories on all shared storage devices. Similarly to getExternalFilesDir() (/reference/android/content/Context.html#getExternalFilesDir(ng.String)), no additional permissions are needed by your app to access the returned paths. The platform periodically scans for new media in these directories, but you can also use MediaScannerConnection(/reference/android/media/MediaScannerConnection.html) to explicitly scan for new content.Wireless & ConnectivityMultiple network connectionsAndroid 5.0 provides new multi-networking APIs that let your app dynamically scan for available networks with specific capabilities, and establish a connection to them. This functionality is useful when your app requires a specialized network, such as an SUPL, MMS, or carrier-billing network, or if you want to send data using a particular type of transport protocol.To select and connect to a network dynamically from your app, follow these steps:1. Create a ConnectivityManager.2. Use the NetworkRequest.Builder class to create an NetworkRequest object and specify the network features andtransport type your app is interested in.3. To scan for suitable networks, call requestNetwork() or registerNetworkCallback(), and pass in theNetworkRequest object and an implementation of workCallback. Use therequestNetwork() method if you want to actively switch to a suitable network once it’s detected; to receive only notifications for scanned networks without actively switching, use the registerNetworkCallback() methodinstead.When the system detects a suitable network, it connects to the network and invokes the onAvailable()(/reference/android/net/workCallback.html#onAvailable(work)) callback. You can use the Network (/reference/android/net/Network.html) object from the callback to get additional information about the network, or to direct traffic to use the selected network.Bluetooth Low EnergyAndroid 4.3 introduced platform support for Bluetooth Low Energy (/guide/topics/connectivity/bluetooth-le.html) (Bluetooth LE) in the central role. In Android 5.0, an Android device can now act as a Bluetooth LE peripheral device. Apps can use this capability to make their presence known to nearby devices. For instance, you can build apps that allow a device to function as a pedometer or health monitor and communicate its data with another Bluetooth LE device.The new android.bluetooth.le (/reference/android/bluetooth/le/package-summary.html) APIs enable your apps to broadcast advertisements, scan for responses, and form connections with nearby Bluetooth LE devices. To use the new advertising and scanning features, add the BLUETOOTH_ADMIN (/reference/android/Manifest.permission.html#BLUETOOTH_ADMIN) permissionin your manifest. When users update or download your app from the Play Store, they are asked to grant the following permission to your app: "Bluetooth connection information: Allows the app to control Bluetooth, including broadcasting to or getting information about nearby Bluetooth devices."To begin Bluetooth LE advertising so that other devices can discover your app, call startAdvertising()(/reference/android/bluetooth/le/BluetoothLeAdvertiser.html#startAdvertising(android.bluetooth.le.AdvertiseSettings, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseCallback)) and pass in an implementation of the AdvertiseCallback (/reference/android/bluetooth/le/AdvertiseCallback.html) class. The callback object receives a report of the success or failure of the advertising operation.Android 5.0 introduces the ScanFilter (/reference/android/bluetooth/le/ScanFilter.html) class so that your app can scan for only the specific types of devices it is interested in. To begin scanning for Bluetooth LE devices, call startScan()(/reference/android/bluetooth/le/BluetoothLeScanner.html#startScan(android.bluetooth.le.ScanCallback)) and pass in a list of filters. In the method call, you must also provide an implementation of ScanCallback(/reference/android/bluetooth/le/ScanCallback.html) to report when a Bluetooth LE advertisement is found.NFC enhancementsAndroid 5.0 adds these enhancements to enable wider and more flexible use of NFC:Android Beam is now available in the share menu.Your app can invoke the Android Beam on the user’s device to share data by calling invokeBeam(). This avoids the need for the user to manually tap the device against another NFC-capable device to complete the data transfer.You can use the new createTextRecord() method to create an NDEF record containing UTF-8 text data.If you are developing a payment app, you now have the ability to register an NFC application ID (AID) dynamically by calling registerAidsForService(). You can also use setPreferredService() to set the preferred card emulation service that should be used when a specific activity is in the foreground.Project VoltaIn addition to new features, Android 5.0 emphasizes improvements in battery life. Use the new APIs and tool to understand and optimize your app’s power consumption.Scheduling jobsAndroid 5.0 provides a new JobScheduler (/reference/android/app/job/JobScheduler.html) API that lets you optimize battery life by defining jobs for the system to run asynchronously at a later time or under specified conditions (such as when the device is charging). Job scheduling is useful in such situations as:The app has non-user-facing work that you can defer.The app has work you'd prefer to do when the unit is plugged in.The app has a task that requires network access or a Wi-Fi connection.The app has a number of tasks that you want to run as a batch on a regular schedule.A unit of work is encapsulated by a JobInfo (/reference/android/app/job/JobInfo.html) object. This object specifies the scheduling criteria.Use the JobInfo.Builder (/reference/android/app/job/JobInfo.Builder.html) class to configure how the scheduled task should run. You can schedule the task to run under specific conditions, such as:Start when the device is chargingStart when the device is connected to an unmetered networkStart when the device is idleFinish before a certain deadline or with a minimum delayFor example, you can add code like this to run your task on an unmetered network:JobInfo uploadTask =new JobInfo.Builder(mJobId,mServiceComponent /* JobService component */).setRequiredNetworkCapabilities(workType.UNMETERED).build();JobScheduler jobScheduler =(JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);jobScheduler.schedule(uploadTask);If the device has stable power (that is, it has been plugged in for more than 2 minutes and the battery is at a healthy level。
android开发资料System Server 分析SystemServer是Android Java层的系统服务模块,这个模块主要功能就是管理供Android应用开发的system service.1.SystemServer 类是如何启动的让我们从Android的启动过程看起,查看init.rc文件,就会发现下面这一行service zygote /system/bin/app_process -Xzygote /system/bin --zygote –start-system-server我们知道zygote进程是整个Android的孵化器进程,所有的Activity进程均是通过它来生成的。
我们发现在zygote进程启动过程中指定了这么一个参数“–start-system-server”,这个参数就是在zygote进程启动的同时启动SystemServer。
那么SystemServer是以什么样的形式启动的呢?是单独的一个进程还是线程,分析一下zygote进程的启动过程就明白了。
在Android中zygote进程启动其实就是启动/system/bin/app_process这个进程,这个进程的源代码在frameworks/base/cmds/app_process/app_main.cpp中。
view plaincopy to clipboardprint?1if(0==strcmp("--zygote",arg)){2bool startSystemServer=(i<argc)?3strcmp(argv[i],"--start-system-server")==0:false;4setArgv0(argv0,"zygote");5set_process_name("zygote");6runtime.start("com.android.internal.os.ZygoteInit",7startSystemServer);8}else{9set_process_name(argv0);10runtime.mClassName=arg;11//Remainderofargsgetpassedtostartupclassmain()12runtime.mArgC=argc-i;13runtime.mArgV=argv+i;14LOGV("Appprocessisstartingwithpid=%d,class=%s.\n",15getpid(),runtime.getClassName());16runtime.start();17}由于zygote进程启动过程有“--zygote”这个参数,所以走的是下面这步runtime.start("com.android.internal.os.ZygoteInit",startSystemServ er);查看对象runtime的类型的定义,class AppRuntime : public AndroidRuntime因此查看AndroidRuntime的start方法中的一段代码(frameworks/base/core/jni/AndroidRuntime.cpp)18viewplaincopytoclipboardprint?startClass=env->FindClass(slashClassName);19if(startClass==NULL){20LOGE("JavaVMunabletolocateclass'%s'\n",slashClassName);21/*keepgoing*/22}else{23startMeth=env->GetStaticMethodID(startClass,"main",24"([Ljava/lang/String;)V");25if(startMeth==NULL){26LOGE("JavaVMunabletofindmain()in'%s'\n",className);27/*keepgoing*/28}else{29env->CallStaticVoidMethod(startClass,startMeth,strArray) ;30#if031if(env->ExceptionCheck())32threadExitUncaughtException(env);33#endif34}35}其中startClass即为"com.android.internal.os.ZygoteInit",这段代码调用了com.android.internal.os.ZygoteInit的main函数。
(带答案)Android复习资料选择题1. 下面不是Android四大组件之一的(B )A. ActivityB.IntentC. ServiceD. ContentProvider2. 下面关于广播叙述错误的是(A)A. 广播是Android四大组件之一B. BroadcastReceiver有两种注册方式,静态注册和动态注册C. 静态注册需要在Mainfest.xml中配置D. 动态注册需要在应用退出时候接触广播的注册。
3. 下面关于BroadcastReceiver错误的是(B):A. BroadcastReceiver有两种注册方式,静态注册和动态注册。
B. BroadcastReceiver必须在AndroidMainfest文件中声明C. BroadcastReceiver的使用,一定有一方发送广播,有一方监听注册广播,onReceive方法才会被调用。
D. 广播发送的Intent都是隐式启动。
4. 下面关于谁先接收广播顺序错误的是(B)A. 有序广播,优先级高的先接收B. 有序广播,同优先级的动静态广播接收器,静态优先于动态。
C. 有序广播,同优先级的动态广播接收器,先注册的大于后注册的。
D. 普通广播时,无视优先级,动态广播接收器优先于静态广播接收器5. 下面关于广播说法错误的是(B)A. 广播分为有序广播和无序广播B. 使用abortBroadcast方法可以中断所有广播的传递。
C. 广播注册方式分为动态和静态D. sendOrderBroadcast用来向系统广播有序事件,sendBroadcast()是用来广播无序事件。
6. 下列关于Intent启动组件说法错误的是(C)A.startActivity( )B. startService( )C. startBroadcastReceiver()D.startActivityForResult()7. 对于广播的发送,Intent的启动方式是(B)A.显式启动B. 隐式启动C. A和B都可以D. 以上说法都不正确。
什么是AndroidAndroid是基于Linux内核的软件平台和操作系统,是Google在2007年11月5日公布的手机系统平台,早期由Google开发,后由开放手机联盟(英语:Open Handset Alliance)(Open Handset Alliance)开发。
它采用了软件堆层(software stack,又名以软件叠层)的架构,主要分为三部分。
低层以Linux内核工作为基础,只提供基本功能;其他的应用软件则由各公司自行开发,以Java作为编写程序的一部分。
另外,为了推广此技术,Google和其它几十个手机公司建立了开放手机联盟。
Android在未公开之前常被传闻为Google电话或gPhone。
大多传闻认为Google开发的是自己的手机电话产品,而不是一套软件平台。
到了2010年1月,Google始发表自家品牌手机电话的Nexus One。
第一台上市的 Android 手机开发Google于2005年并购了成立仅22个月的高科技企业Android,展开了短信、手机检索、定位等业务,同时基于Linux的通用平台也进入了开发。
2008 Patrick Brady于Google I/O 演讲“Anatomy & Physiology of an Android”,并提出的 Android HAL 架构图。
HAL 以●.so 档的形式存在,可以把 Android framework 与Linux kernel 隔开。
公布前的传闻Google的东南亚销售与营运常务董事Richard Kimber曾说:"At this point in time, we are very focused on the software, not the phone.(目前我们完全专注于软件而非电话)"。
可是Google并未正式否认正在制作电话的传闻,Google可能与一家硬件生产商合作创作 Google Phone。
每次在网站查阅一些android资料时,经常看到一些朋友在网上留言咨询现在国内有哪些a ndroid开发网站/社区,以我本人现在对国内android网站的了解程序,及各个android 网站的关注热度,下面我就有大家大概的罗列一下android开发网站,希望对各个需要帮助的有一定的用处,论坛:1,2./3./4./forums/tag/Android5./yuanmaxiazai/564.html6./cmdn/bbs/thread-21365-1-1.html7./bbs/8,/dev/thread.php?fid-9.html8./10./?page_id=117611./12./index.php13./及android开发中最常遇到的一些问题总结:欢迎转载,转载请注明出自:www:This is the FAQ for the Android forum.General questions∙What Java API is supported by Android? How does it differ from JME?o See hereo Dalvik - Googles tweaked JVM for Android∙Where can I get an SDK? What platforms does it support?o The latest version of the SDK is r20 (for Android versions up to 4.1), and it's available for Windows, OS X and Linuxhere.∙Do I need to buy hardware if I want to start writing applications that run on Android?o You can start writing applications even if you don’t have hardware to run them on. The Android SDK comes with anemulator and all tools necessary for application developmentand deployment.o Another option is the freely available Motodev Studio for Android IDE from Motorola.∙Which hardware devices support Android? Here's an incomplete list: o T-Mobile G1(a.k.a. HTC Dream), myTouch 3G, myTouch 4G, Comet(a.k.a. Huawei Ideos)o HTC Magic, Hero, Tattoo, Droid Eris, Legend, Desire, Evo 4G, Wildfire, Incredible, Aria, Evo 4G, Gratia, Flyer, ChaCha andSalsa, Desire S, Wildfire S and Incredible S, Sensation,Wildfire S, Rezound, Sensation XEo Motorola Dext, Droid / Milestone, Backflip, Motoroi, Cliq / Quench, Cliq 2, Devour, Flipout, XT720, Droid 2, Droid X,Charm, Defy, Defy+, Droid Pro, Droid 2 Global, Droid Bionic,XOOM, Atrix 4G, Droid X2, Droid 3, XOOM 2o Sony Ericsson Xperia X10, Xperia X10 mini, Xperia arc, Xperia Play, Xperia Pro and Xperia Neoo Google Nexus One (only available to Android developers by now), Nexus So LG In TouchMax GW620, Optimus, Optimus 3D, G-Slate tableto Samsung Galaxy i7500, Galaxy Portal i5700, Captivate / Galaxy S, Vibrate, Galaxy S i9000, Galaxy Tab, Galaxy I9003 SL,Vibrant 4G, Galaxy Indulge, Galaxy Tab 10.1, Galaxy S II,Xcover, Galaxy S II Skyrocket, Captivate Glide, Galaxy Note o Garmin-Asus A50o Acer Stream, Iconia Smart, A 200o ZTE Skateo Huawei IDEOS X3 and S7 Slimo Dell Streako Archos 28, 32, 43, 70 and 101, Q9o Asus Transformer Primeo Handset NEWS (and rumors) at AndroidGuyso WikiPedia ist_of_Android_deviceso extensive list at TechCrunch?∙What is Dalvik? How is it different from JVM?o Dalvik is a register based virtual machine optimized to run on a slow CPU,with relatively little RAM and on an OS withoutswap space. Further Reading∙What are the different Media formats supported on Android?o See here∙Where can I publish my Android applications?o Android Market (instructions)o Voeveoo SlideMEo AndAppStoreo AndroLibo Cyrketo AndroidPIT (in German)o AndSpoto AppBraino Aproovo AppsLib (targeted specifically at tablets)o Amazon appstore (in beta)o GetJar (covers other mobile OS as well)∙How can I get insight into how people are using my app?o Integrating the Google Analytics for Android library will provide you with quantitative feedback on your app's usage. ∙I'd like to display ads in my app without having to negotiate it all by myself. What are my options?o AdMob, mobclix, Millennial Media, InMobi and JumpTap are Android-compatible ad networks. Also check out adwhirl,which puts a common interface on top of several networks. ∙What support does Android or Dalvik VM provide for running nativeC code?o In June 2009, Google announced a NDK(Native Development Kit) that gives developers the ability to call into native codefrom Android applications. There is a Google group forNDK-related discussions. At present, Android supports JNIshared libraries written in C or C++ that link with theAndroid versions of libc, libm, libz and OpenGL ES 2.0. Thereare plans to support linking with audio libraries in future. ∙How do I get Android source code?o See this documento You can also browse it online here∙How can I view PDFs and Office documents?o Options include Documents To Go, RepliGo Reader, MultiReader ∙Which Android versions are being used out in the field?o Google tracks the versions that access the Android Market, which should be a useful proxy number.Programming∙Is Android code compiled to a .class file?o The Java bytecode of a compiled class is converted into Dalvik executables or (.dex) files, using the "dx" tool bundled withthe SDK . The application is packaged into .apk file whichare zipped .dex files. The Dalvik virtual machine runs Dalvikexecutables in the apk file. Details of .dex file format canbe found here∙I want to write Android Applications too but dont know where to start?o Try Hello World tutorial.o Read Application Fundamentalso Try sample code distributed with the SDK.∙Do Android projects have deployment descriptors?o AndroidManifest.xml∙My Application throws an Exception, where is the Stack Trace dumped?o Exceptions are written to a log file, named Logcat in the emulator. You can obtain a dump by executing the adb logcatcommand. To write log messages from your application, use thestatic methods of JavaDoc:android.util.Log class(Log.v(),Log.d(), Log.i(), etc.). If you are using Eclipse with ADTplugin, you can open "Logcat" view to see the logged messages.∙What functionality of the actual device can the emulator emulate?o For Emulator How-Tos and limitations, read this ∙How can I send email from an Android application?o See this threado A JavaMail?port has been written for Android and can be found hereo article on sending mail with user interaction ∙javax.xml.xpath is not supported; how can I use XPath anyway?o The jaxen library runs on Android, and works well with DOM objects. Just put its jar file into the "libs" folder of yourproject, and it'll be packaged along with the other classfiles. Starting with Android 2.2, javax.xml.xpath is part ofthe core libraries.∙What options for storing data do I have?o Understanding Android local data store APIs introduces preferences, SQLite, and the internal and external memoryAPIs. See What's Your Preference?part 1and part 2for moreinformation particularly on Preferences.Reference material∙Android Home Page∙Developer Guide∙API ReferenceBooks∙Application Security for the Android Platform by Jeff Six∙by Mark Murphy: Beginning Android, Busy Coder's Guide to Android Development, Busy Coder's Guide to Advanced Android Development, Android Programming Tutorials∙Hello, Android: Introducing Google's Mobile Development Platform by Ed Burnette∙Unlocking Android by Frank Ableson, Charlie Collins, and Robi Sen;the 2nd ed. is called Android in Action∙Professional Android 2 Application Development by Reto Meier ∙Android Wireless Application Development and Sams Teach Yourself Android Application Development in 24 Hours by Shane Conder and Lauren Darcey∙Pro Android Games by Vladimir Silva∙Learn Java for Android Development by Jeff Friesen∙The Android Developer's Cookbook: Building Applications with the Android SDK by James Steele and Nelson To∙Practical Android Projects by Lucas Jordan and Pieter Greyling ∙Android in Practice by Charlie Collins, Michael D. Galpin, and Matthias Kaeppler (early access)∙Pro Android 3: A Developers Handbook by Komatineni, MacLean? and HashimiOther∙Android Developers Blog∙Android Development Wiki∙Article Master Google Android: 40 Tips and Tricks∙Frameworks for developing cross-platform mobile applications: Rhodes, Titanium Mobile, Unity, Corona, Pyxis Mobile ∙The Gingerbread (aka Android 2.3) FAQ∙The Ice Cream Sandwich (aka Android 4.0) FAQ, Android 4.0 upgrade list: Is your device getting Ice Cream Sandwich?。
Android一词的本义指“机器人”,同时也是Google于2007年11月5日宣布的基于Linux平台的开源手机操作系统的名称,该平台由操作系统、中间件、用户界面和应用软件组成,号称是首个为移动终端打造的真正开放和完整的移动软件。
目前,最新版本为Android 2.4 Gingerbread和Android 3.0 Honeycomb霸十年的诺基亚(Nokia)Symbian OS系统,采用Android系统主要手机厂商包括宏达电子(HTC)、三星(SAMSUNG)、摩托罗拉(MOTOROLA)、LG、Sony Ericsson、魅族M9、联想(LENOVO)、中兴通讯(ZTE)、华为等,使之跃居全球最受欢迎的智能手机平台,Android系统不但应用于智能手机,也在平板电脑市场急速扩张。
应用程序Android以Java为编程语言,使接口到功能,都有层出不穷的变化,其中Activity等同于J2ME的MIDlet,一个 Activity 类(class)负责创建视窗(window),一个活动中的Activity就是在 foreground(前景)模式,背景运行的程序叫做Service。
两者之间通过由ServiceConnection 和AIDL连结,达到复数程序同时运行的效果。
如果运行中的 Activity 全部画面被其他 Activity 取代时,该 Activity 便被停止(stopped),甚至被系统清除(kill)。
View等同于J2ME的Displayable,程序人员可以通过 View 类与“XML layout”档将UI放置在视窗上,Android 1.5的版本可以利用 View 打造出所谓的 Widgets,其实Widget只是View的一种,所以可以使用xml来设计layout,HTC的Android Hero手机即含有大量的widget。
至于ViewGroup 是各种layout 的基础抽象类(abstract class),ViewGroup之内还可以有ViewGroup。
View的构造函数不需要再Activity中调用,但是Displayable的是必须的,在Activity 中,要通过findViewById()来从XML 中取得View,Android的View类的显示很大程度上是从XML中读取的。
View 与事件(event)息息相关,两者之间通过Listener 结合在一起,每一个View都可以注册一个event listener,例如:当View要处理用户触碰(touch)的事件时,就要向Android框架注册View.OnClickListener。
另外还有Image等同于J2ME的BitMap。
中介软件操作系统与应用程序的沟通桥梁,并用分为两层:函数层(Library)和虚拟机(Virtual Machine)。
Bionic是 Android 改良libc的版本。
Android 同时包含了Webkit,所谓的Webkit 就是Apple Safari 浏览器背后的引擎。
Surface flinger 是就2D或3D的内容显示到屏幕上。
Android 使用工具链(Toolchain)为Google自制的Bionic Libc。
Android采用OpenCORE作为基础多媒体框架。
OpenCORE可分7大块:PVPlayer、PVAuthor、Codec、PacketVideo Multimedia Framework(PVMF)、Operating System Compatibility Library(OSCL)、Common、OpenMAX。
Android 使用skia 为核心图形引擎,搭配OpenGL/ES。
skia与Linux Cairo功能相当,但相较于Linux Cairo, skia 功能还只是阳春型的。
2005年Skia公司被Google收购,2007年初,Skia GL源码被公开,目前Skia 也是Google Chrome 的图形引擎。
Android的多媒体数据库采用SQLite数据库系统。
数据库又分为共用数据库及私用数据库。
用户可通过ContentResolver类(Column)取得共用数据库。
Android的中间层多以Java 实现,并且采用特殊的Dalvik 虚拟机(Dalvik Virtual Machine)。
Dalvik虚拟机是一种“暂存器型态”(Register Based)的Java虚拟机,变量皆存放于暂存器中,虚拟机的指令相对减少。
Dalvik虚拟机可以有多个实例(instance), 每个Android应用程序都用一个自属的Dalvik虚拟机来运行,让系统在运行程序时可达到优化。
Dalvik 虚拟机并非运行Java字节码(Bytecode),而是运行一种称为.dex 格式的文件。
硬件抽像层(Hardware Abstraction Layer)Android 的 HAL(硬件抽像层)是能以封闭源码形式提供硬件驱动模块。
HAL 的目的是为了把 Android framework 与 Linux kernel 隔开,让Android 不至过度依赖 Linux kernel,以达成 kernel independent 的概念,也让 Android framework 的开发能在不考量驱动程序实现的前提下进行发展。
HAL stub 是一种代理人(proxy)的概念,stub 是以 *.so 档的形式存在。
Stub 向HAL“提供”操作函数(operations),并由 Android runtime 向 HAL 取得 stub 的 operations,再 callback 这些操作函数。
HAL 里包含了许多的 stub(代理人)。
Runtime 只要说明“类型”,即 module ID,就可以取得操作函数。
编程语言Android 1.1发布时间:发布于 2009 年 2 月代表手机:T-MOBILE G1Android 1.5发布于 2009 年 5 月代表手机:摩托罗拉CILQAndroid 1.62009 年 9 月发布代表手机:索尼爱立信 X10Android 2.0 Eclair2009 年 10 月 26 日代表机型:摩托罗拉XT800,HTC G6Android 2.1 EclairAndroid 2.1: 2009 年 10 月 26 日,又一个主要版本升级以创纪录的速度放出。
这次,大版本升级到了Android 2.1 “Eclair.”Android 2.1主要特性:提升硬件速度更多屏幕以及分辨率选择大幅度的用户界面改良支持 Exchange活动墙纸幅改进虚拟键盘蓝牙 2.1Google 地图Android 2.0.1 SDK 于 2009 年 12 月 3 日发布,之后是2010 年 1 月 10 日的 2.1 版本。
很多用户和围观群众可能会奇怪:“为什么Android 会用甜点作为它们系统版本的代号?”,这个命名方法开始于Andoird 1.5 发布的时候。
作为每个版本代表的甜点的尺寸越变越大,然后按照字母数序:小蛋糕,甜甜圈还有松饼。
之前人们预计 2.2 版本的代号会是“馅饼”,但这个被最终证明是错误的,“FroYo”(冻酸奶)才是Android 2.2这个伴随 Google Nexus One 发布的新版的最新代号Android 2.2 Froyo谷歌于北京时间2010年5月20日晚上10:30点在旧金山Moscone会展中心举办Google I/O 2010大会第二天的会议,Google正式发布了代号是“f royo 冻酸奶”的Android操作系统2.2版。
相对于上一版本的改变:1、整体性能大幅度的提升2、3G网络共享功能。
3、Flash的支持。
4、App2sd功能。
5、全新的软件商店。
6、更多的Web应用API接口的开发Android 2.3 Gingerbreadgingerdroid北京时间2010年12月7日凌晨,Google正式对外发布了他们的下一代智能手机操作系统Android 2.3也就被大家所熟知的Android Gingerbread 系统。
主要更新包括:游戏:增加了新的垃圾回收和优化处理事件,以提高对游戏的支持能力。
原生代码可直接存取输入和感应器事件、EGL/OpenGL ES、OpenSL ES。
新的管理窗口和生命周期的框架。
多媒体:支持VP8和WebM视频格式,提供AAC和AMR宽频编码,提供了新的音频效果器,比如混响、均衡、虚拟耳机和低频提升通讯方式:支持前置摄像头、SIP/VOIP和NFC(近场通讯)站在用户的角度看,这次更新的亮点主要有:简化界面、速度提升:更快更直观的文字输入:一键文字选择和复制/粘帖:改进的电源管理系统:新的应用管理方式:原生支持前置前置摄像头、互联网通话和NFC(近场通讯):系统原生支持VoIP,可以在联系人里加入它的SIP帐户,然后直接通过系统来拨打VoIP电话。
增加下载管理器:Android 2.4 Gingerbread就像Android 2.0和2.1版本都使用Eclair(法式奶油夹心甜点)一样,Android 2.3和2.4将会共享Gingerbread(姜饼)代号。
这两个版本之间的变化不会太大,但是会有不少功能更新。
目前已知的Android 2.4带来的更新包括更多的动画特效、更快的运行速度、软件通话降噪、视频聊天等。
Android 2.4系统不会是之前一直谣传的Android 3.0,其真正的版本号将会是Android 2.4。
Android 3.0 Honeycomb2011年2月3日凌晨,谷歌正式发布了专用于平板电脑的Android 3.0 Honeycomb系统。
这是首个基于Android的平板电脑专用操作。
首款采用Android3.0系统的是MOTO XOOM。
该机是摩托罗拉移动在2011年1月5日,在美国拉斯维加斯CES电子消费展推出的旗下首款平板电脑。
3.0系统特性·专用于平板电脑·全新设计的UI增强网页浏览功能·n-app purchases功能·经过优化的Gmail电子邮箱;·全面支持Google Maps编辑本段最新消息北京时间3月25日消息,据国外媒体报道,谷歌周四表示,谷歌暂停开源Android3.0,并将暂时阻止小型手机生产商使用其Android3.0“Honeycomb”系统,期限未定。
谷歌一位发言人通过电子邮件声明称,Honeycomb是专为平板电脑而非手机设计的,在该系统以开源形式发布前,还有很多工作要做。