目录第一章 Android Studio 简介及其环境搭建....................................................................................41.1 Android Studio 简介 ...........................................................................................................41.1.1 Android Studio 能做什么 ........................................................................................41.1.2 为什么选择 Android Studio ....................................................................................41.2 Android 系统基本知识.......................................................................................................51.3 搭建环境.............................................................................................................................61.3.1 第一步 安装 JDK(Java Development Kit)................................................................61.3.2 第二步 更新 hosts.................................................................................................71.3.3 第三步 安装 Android Studio...................................................................................71.4 新建项目...........................................................................................................................131.5 运行 App...........................................................................................................................171.5.1 运行在模拟器上....................................................................................................171.5.2 运行在手机上........................................................................................................21第二章 Android Studio 基本概念 .................................................................................................222.1 开发环境..........................................................................................................................222.1.1 菜单........................................................................................................................222.1.2 工具栏....................................................................................................................232.1.3 项目文件................................................................................................................232.1.4 视图 view..............................................................................................................242.1.5 布局........................................................................................................................252.2 建立简单的用户界面......................................................................................................252.3 字符串资源文件...............................................................................................................262.4 增加一个按钮...................................................................................................................272.5 创建一个新的窗体步骤...................................................................................................282.5.1 第一步:创建布局文件.......................................................................................282.5.2 第二步:创建对应的 Activity...............................................................................292.5.3 第三步:布局文件与 Activity 关联......................................................................302.5.4 第四步:在 AndroidManifest.xml 里声明...........................................................312.6 调用一个窗体..................................................................................................................312.6.1 调用方...................................................................................................................312.6.2 被调用方...............................................................................................................33无法打开另一个窗体时检查:.............................................................................................34缺少 SKD 平台 ........................................................................................................................34第三章 Android Studio 编程语言基础 .........................................................................................363.1 Java 代码的基本知识.......................................................................................................373.2 数据类型..........................................................................................................................383.2.1 常用数据类型.......................................................................................................383.2.2 类型转换...............................................................................................................403.2.3 常量和变量............................................................................................................403.2.3 在 Android 开发中的运用....................................................................................403.3 运算符...............................................................................................................................413.3.1 算术运算..............................................................................................................413.3.2 比较运算..............................................................................................................413.3.3 逻辑运算..............................................................................................................423.3.4 示例.......................................................................................................................423.4 控制语句...........................................................................................................................423.4.1 分支控制语句........................................................................................................423.4.2 示例.......................................................................................................................433.4.3 循环控制语句.......................................................................................................433.4.4 示例.......................................................................................................................443.5 异常处理..........................................................................................................................453.6 Android Studio 面向对象初步..........................................................................................473.6.1 类与对象...............................................................................................................473.6.2 使用类...................................................................................................................483.6.3 Java 中的继承.......................................................................................................493.6.4 包 ...........................................................................................................................50第 4 章 Android Studio 界面布局 .................................................................................................524.1 相对布局 RelativeLayout.................................................................................................524.2 帧布局 FrameLayout........................................................................................................544.3 线性布局 LinearLayout....................................................................................................584.4 表格布局 TableLayout .....................................................................................................584.5 网格布局 GridLayout.......................................................................................................60第 5 章 Android Studio 视图工具箱 .............................................................................................625.1 使用 View.........................................................................................................................625.2 常用 View 的使用............................................................................................................625.2.1 文本框 TextView。................................................................................................635.2.2 编辑框 EditText......................................................................................................635.2.3 单项选择 RadioGroup 和 RadioButton .................................................................635.2.4 多项选择 CheckBox...............................................................................................655.2.5 图片视图 ImageView.............................................................................................655.2.6.日期选择器(DatePicker) ..................................................................................675.2.7 下拉列表 Spinner.................................................................................................685.3 小结 .................................................................................................................................69第 6 章 多线程的实现...................................................................................................................706.1 计时器范例......................................................................................................................706.2 布局文件...........................................................................................................................706.2 设置按钮状态..................................................................................................................716.3 更新计时器......................................................................................................................726.4 运行计时器.......................................................................................................................73第 7 章管理 Activity 生命周期......................................................................................................757.1 Activity 生命周期理论知识......................................................................................757.1.1 Activity 生命周期的 5 种状态...............................................................................757.1.2 生命周期状态的调用...........................................................................................767.2 生命周期概念的应用.......................................................................................................767.2.1 LogCat 观察运行....................................................................................................777.2.2 修复 Activity 生命周期问题.................................................................................807.3 其它有关 Activity 的知识.................................................................................................827.3.1 销毁 activity...........................................................................................................827.3.2 停止和重启一个 activity .......................................................................................827.3.3 停止 activity...........................................................................................................827.3.4 启动/重启 activity .................................................................................................837.3.5 重建 activity...........................................................................................................847.3.6 保存 active 状态....................................................................................................857.3.7 恢复 active 状态....................................................................................................85第八章 简单数据和文件的存取...................................................................................................878.1 键-值对数据的存取 ........................................................................................................878.2 文件的存取.......................................................................................................................888.2.1 选择内部或外部存储器........................................................................................888.2.2 获得外部存储许可................................................................................................898.2.3 保存文件到内部存储器........................................................................................898.2.4 保存文件在外部存储器........................................................................................918.2.5 查询空闲空间........................................................................................................928.2.6 删除文件................................................................................................................93第 9 章 数据库操作.......................................................................................................................949.1 创建数据模型..................................................................................................................949.2 SQLiteOpenHelper 类详解................................................................................................949.2.1 SQLiteOpenHelper 类.............................................................................................959.2.2 创建数据库...........................................................................................................969.2.3 数据库升级............................................................................................................969.3 创建数据库和表..............................................................................................................979.4 数据库操作.......................................................................................................................989.4.1 创建菜单...............................................................................................................989.4.2 创建新增、修改的 Activity..................................................................................999.4.3 新增记录.............................................................................................................1019.4.4 显示数据.............................................................................................................1019.4.5 修改数据.............................................................................................................1049.5 其它 ...............................................................................................................................106第 10 章 Intent 详解--与其它 App 交互......................................................................................10710.1 调用 Activity 并返回结果............................................................................................10710.1.1 启动 Activity ......................................................................................................10710.1.2 工作过程...........................................................................................................10910.2 调用其它 APP 服务......................................................................................................11010.2.1 调用动作...........................................................................................................11010.2.2 获取结果...........................................................................................................11310.3 让其它 app 启动你的 Activity .....................................................................................11510.3.1 增加一个 intent 过滤器....................................................................................11510.3.2 显示 app 选择器 ...............................................................................................11710.3.3 在你的 Activity 处理 intent...............................................................................11710.3.4 返回结果............................................................................................................118
评论