• 博客(0)
  • 资源 (2)

空空如也

Android 文件读写源码

public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button) this.findViewById(R.id.button); button.setOnClickListener(new ButtonClickListener()); } private final class ButtonClickListener implements View.OnClickListener{ public void onClick(View v) { EditText filenameText = (EditText) findViewById(R.id.filename); EditText contentText = (EditText) findViewById(R.id.filecontent); String filename = filenameText.getText().toString(); String content = contentText.getText().toString(); FileService service = new FileService(getApplicationContext()); try { //判断SDCard是否存在,并且可以读写 if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ service.saveToSDCard(filename, content); Toast.makeText(getApplicationContext(), R.string.success, 1).show(); }else{ Toast.makeText(getApplicationContext(), R.string.sdcarderror, 1).show(); } } catch (Exception e) { Toast.makeText(getApplicationContext(), R.string.fail, 1).show(); e.printStackTrace(); } } } }

2015-11-22

Android入门到精通详解

第一篇Android系统结构和SDK使用...............................................................................4 第1章Android的系统介绍......................................................................................4 1.1 系统介绍.......................................................................................................5 1.2 软件结构和使用的工具...............................................................................9 第2章Android SDK的开发环境...........................................................................12 2.1 Android SDK的结构.....................................................................................13 2.2 Android SDK环境安装.................................................................................15 2.3 Android中运行仿真器环境..........................................................................31 2.4 Android中建立工程......................................................................................45 第二篇 Android应用程序的概述和框架..........................................................................56 第3章Android应用层程序的开发方式..................................................................56 3.1 应用程序开发的结构...................................................................................57 3.2 API参考文档的使用.....................................................................................58 第4章Android应用程序示例................................................................................63 4.1 HelloActivity程序的运行..........................................................................64 4.2 HelloActivity的源文件结构......................................................................65 4.3 HelloActivity的编译结构..........................................................................69 4.4 SkeletonApp的程序的运行.......................................................................69 4.5 SkeletonApp的源文件结构.......................................................................71 4.6 SkeletonApp的编译结构...........................................................................73 第5章Android应用程序的内容..............................................................................74 5.1 Android应用程序的概念性描述...............................................................75 5.2 应用程序包含的各个文件.........................................................................82 5.3 使用am工具启动Android应用程序.......................................................84 第三篇Android的UI系统实现.........................................................................................86 第6章UI的基本外形和控制...................................................................................86 6.1 控件和基本事件的响应.............................................................................87 6.2 键盘事件的响应...........................................................................................93 6.3 运动事件的处理...........................................................................................96 6.4 屏幕间的跳转和事件的传递.....................................................................100 6.5菜单的使用..................................................................................................106 6.6弹出对话框..................................................................................................109 Android入门到精通详解 3 6.7 样式的设置.................................................................................................118 第7章控件(Widget)的使用...............................................................................125 7.1 Android中控件的层次结构.....................................................................126 7.2 基本控件的使用.......................................................................................127 7.3 自定义的视图.............................................................................................138 第8章视图组(ViewGroup)和布局(Layout)的使用.....................................142 8.1 Android的屏幕元素体系............................................................................143 8.2 几种独立使用的视图组.............................................................................145 8.3 作为简单容器使用的视图组............................................................153 8.4 布局(Layout)..........................................................................................159 8.5 网格(Grid)视图组................................................................................167 8.6 列表(List)视图组.................................................................................172 8.7 使用Tab组织UI......................................................................................177 第9章2D图形接口的使用....................................................................................182 9.1 使用2D图形接口的程序结构。..............................................................183 9.2 图像、图形、文本的基本绘制.................................................................185 9.3 文本的对齐方式.........................................................................................188 9.4 使用路径效果(PathEffect).....................................................................190 9.5 剪裁效果.....................................................................................................193 9.6 记录绘制的过程.........................................................................................195 9.7 动画效果.....................................................................................................197 第10章OpenGL 3D图形的使用............................................................................200 10.1 使用OpenGL图形接口的程序结构。...................................................201 10.2 基本的绘制...............................................................................................202 10.3 渲染器的实现...........................................................................................204 10.4 3D动画效果的实现..................................................................................207

2015-11-22

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除