- 浏览: 1206102 次
- 性别:
- 来自: 荆州
文章分类
- 全部博客 (396)
- Android 基础 (72)
- Java 基础 (42)
- Android(动画效果) (26)
- Android(自定义组件) (13)
- Android(手机服务) (38)
- Android(网络相关) (27)
- Android(多媒体) (12)
- Android(小技巧) (30)
- Android(用户界面) (39)
- 基础概念 (24)
- Android组件学习 (21)
- Android数据库相关 (11)
- 生活杂谈 (10)
- 调试技巧部分 (8)
- Sql Server相关 (1)
- Android(xml相关) (2)
- Android 开发 (12)
- 韩语学习 (4)
- Mac添加环境变量的三种方法 (1)
- iPhone开发 (1)
- Android Studio (1)
最新评论
-
ppfbsar:
下载网络文件到SD卡上 -
851228082:
好文!彻底理解单类型导入与按需导入的区别了。还有一点可以通过 ...
谈java的导入(import) -
麦田的设计者:
老乡啊
sqlite 数据库保存图片 -
sf_dream:
我要是读写list、map之类的集合呢
ObjectOutputStream和ObjectInputStream类的学习 -
xfyunyun:
博主,请问webview加载html字符串时怎么进行缓存处理呢 ...
WebView使用总结2(加载HTML内容形式的String)
通过下面这个例子我们可以了解存储卡,缓存等文件路径
1. DisplayFiles.java文件
2.main.xml文件
1. DisplayFiles.java文件
package cn.com; import java.io.File; import android.app.Activity; import android.os.Bundle; import android.os.Environment; import android.view.View; import android.widget.Button; import android.widget.Toast; public class DisplayFiles<bRootDirectory> extends Activity { private Button bPhoneDirectory; private Button bDataDirectory; private Button bDownloadCacheDirectory; private Button bExternalStorageDirectory; private Button bRootDirectory; private File fPhoneDirectory; private File fDataDirectory; private File fDownloadCacheDirectory; private File fExternalStorageDirectory; private File fRootDirectory; private String name; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); bPhoneDirectory = (Button) findViewById(R.id.bPhoneDirectory); bRootDirectory = (Button) findViewById(R.id.bDataDirectory); bDownloadCacheDirectory = (Button) findViewById(R.id.bDownloadCacheDirectory); bExternalStorageDirectory = (Button) findViewById(R.id.bExternalStorageDirectory); bRootDirectory = (Button) findViewById(R.id.bRootDirectory); bDataDirectory = (Button) findViewById(R.id.bDataDirectory); fPhoneDirectory = this.getFilesDir(); fDataDirectory = Environment.getDataDirectory(); fDownloadCacheDirectory = Environment.getDownloadCacheDirectory(); fExternalStorageDirectory = Environment.getExternalStorageDirectory(); fRootDirectory = Environment.getRootDirectory(); /* * 没有存储卡的时候按键无效 */ if (Environment.getExternalStorageState().equals( Environment.MEDIA_REMOVED)) { bExternalStorageDirectory.setEnabled(false); } /* * 访问应用程序手机内存 */ bPhoneDirectory.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { String path = fPhoneDirectory.getPath(); name = path + "\n"; ListFiles(path, ""); Toast.makeText(DisplayFiles.this, name, Toast.LENGTH_LONG) .show(); } }); /* * 访问存储卡 */ bExternalStorageDirectory .setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { String path = fExternalStorageDirectory.getPath(); name = path + "\n"; ListFiles(path, ""); Toast.makeText(DisplayFiles.this, name, Toast.LENGTH_LONG).show(); } }); bDownloadCacheDirectory .setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { String path = fDownloadCacheDirectory.getAbsolutePath(); Toast.makeText(DisplayFiles.this, path, Toast.LENGTH_LONG).show(); } }); bRootDirectory.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { String path = fRootDirectory.getAbsolutePath(); Toast.makeText(DisplayFiles.this, path, Toast.LENGTH_LONG) .show(); } }); bDataDirectory.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { String path = fDataDirectory.getAbsolutePath(); Toast.makeText(DisplayFiles.this, path, Toast.LENGTH_LONG) .show(); } }); } private boolean ListFiles(String path, String arr) { File file = new File(path); arr = arr + "\t"; // arr为层次变量,使目录有层次感 for (File f : file.listFiles()) { path = f.getAbsolutePath(); name = name + arr + f.getName() + "\n"; if (f.isDirectory() == true) { ListFiles(path, arr); // 当f为文件夹的时候,进入文件夹中 } } return true; } }
2.main.xml文件
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <Button android:id="@+id/bPhoneDirectory" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/bPhoneDirectory" /> <Button android:id="@+id/bExternalStorageDirectory" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/bExternalStorageDirectory" /> <Button android:id="@+id/bDataDirectory" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/bDataDirectory" /> <Button android:id="@+id/bDownloadCacheDirectory" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/bDownloadCacheDirectory" /> <Button android:id="@+id/bRootDirectory" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/bRootDirectory" /> </LinearLayout>
发表评论
-
GPS定位
2013-04-24 21:25 1835这几天一直在完善GPS定位的问题,现将分享在这里,后面在继续编 ... -
获取正在运行的进程
2012-03-05 15:57 1426public boolean isAppOnForegro ... -
Android条形码
2011-08-10 14:48 1751项目中需要使用到条形码的识别功能模块,今天研究了几个小时,找到 ... -
Android应用发送邮件
2011-06-09 13:03 1816package com.example; impor ... -
Android 程序获取、设置铃声、音量、静音、扬声器
2011-04-07 22:07 4300Android 程序获取、设置铃声和音量 通过程序获取and ... -
关于屏幕解锁的实例
2011-04-07 22:05 4334AndroidManifest.xml加两个权限 &l ... -
群导入数据到手机通讯录
2011-03-18 14:09 12111.核心代码: private Uri inser ... -
应用获取手机本地图片资源
2011-03-18 12:42 1562private Button mGetImg; / ... -
Android 系统广播Action一览验证
2011-02-14 13:04 4164下面我们一个一个的进行说明: 1.android.intent ... -
Android中读取properties文件2
2011-01-20 13:24 2366ReadProperty.java类文件中主要代码块: v ... -
获取SdCard和系统存储空间大小
2011-01-20 10:33 1320/** * 读取Sd卡存储信息 */ void re ... -
Sensor重力感应概念
2010-12-31 23:38 1178以屏幕的左下方为原点(2d编程的时候,是 ... -
接收短信启动相应服务
2010-11-21 09:05 12551.首先是在配置文件中申明一个Receiver: & ... -
模拟发送短信及步骤
2010-09-19 13:25 15471.发送短信的主要代码: String mobile ... -
模拟拨号及步骤
2010-09-19 12:46 17951.通过下面代码进行拨号操作: //当然这里的5556 ... -
代码创建LinearLayout,Services监听线程
2010-09-13 10:18 20321.主Activity: private TextView ... -
ListView显示正在运行的应用
2010-09-10 16:53 1288/* ActivityManager对象向系统取得ACTI ... -
手机服务方面的小技巧集合
2010-09-10 16:30 11131.调用系统拨号页面: /* 调用拨号的画面 */ ... -
ListView显示SIM相关信息
2010-09-10 14:34 1160private TelephonyManager telM ... -
Android获取手机号码(问题)
2010-08-31 13:27 12377手机号码不是所有的都能获取。只是有一部分可以拿到。这个 ...
相关推荐
说明: 测试手机为小米2s,能够完整采集内置加速度传感器数据。 功能: 1.实时显示加速度数据、方向数据 2.计算收集时长(单位:ms) 3.连续计时(允许中断) 4.秒表 5.启动/关闭键(绿表停,红表运行) ...4.文件存储
阅读设置中增加一个“文件缓存”选项,默认情况下是开启的,在NOKIA手机上会提高UMD等文件的表现,但由于测试并不充足,如果程序经常在阅读时出错,请关闭该选项(其它手机是否开启该选项并无明显的影响) ...
2个目标文件,FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户...
> * 支持测试本demo之前先把test文件夹里的文件复制到手机存储,方便测试,路径如下: TBS服务接入 参考腾讯TBS官网,地址:https://x5.tencent.com/tbs/guide/sdkInit.html 效果图 常见问题 no suport by 出现...
2个目标文件,FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户...
个功能强大的应用程序可让您在手机上运行FTP 服务器,并帮助您的朋友或您通过Internet访问/共享文件。它还可以帮助您不要使用设备的USB端口来延长设备的使用寿命。也称为Wifi文件传输或无线文件管理。 应用程序功能 ...
手机端接口都在web.controller.api.SysApiController里面,录音文件上传接口是在cn.ttitcn.web.controller.common.CommonController里面的common/uploadVoice,他的返回值是该录音文件在服务器硬盘中存储的绝对路径...
2个目标文件,FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户...
认识手机的的存储区间 11 手机系统的组成 11 NOR 11 RAM 12 NAND 12 什么是BootLoader? 12 BootLoader 12 引导系统启动 13 下载BIN文件 13 关机充电 13 如何下载BootLoader 13 ...
文件路径错误。 46 数据缓冲区内存分配太小。 46 系统内部解析错误。 47 程序CLSID规范 48 CLSID是什么? 48 CLSID的定义 48 CLSID和BID文件的位置 48 应用引用CLSID 49 CLSID错误的做法 49...
2个目标文件,FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户...
2个目标文件,FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户...
FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户可以在终端上...
FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户可以在终端上...
支持测试本demo之前先把test文件夹里的文件复制到手机存储,方便测试,路径如下: TBS服务接入 参考腾讯TBS官网,地址: 效果图 使用方式 allprojects { repositories { maven { url 'https://jitpack.io' } ...
2个目标文件,FTP的目标是:(1)提高文件的共享性(计算机程序和/或数据),(2)鼓励间接地(通过程序)使用远程计算机,(3)保护用户因主机之间的文件存储系统导致的变化,(4)为了可靠和高效地传输,虽然用户...
实例034:加载手机磁盘中的文件 73 实例035:实现抽屉样式效果 76 实例036:在屏幕中动态显示多种对话框 82 实例037:手机秘书--重要事情提醒 88 实例038:动态添加或删除菜单 96 实例039: 自定义Android控件实现...
thumb(图片id或者路径, 宽度, 高度, 是否水印, 缩放标准值, 是否下载远程图片进行剪切) 缩略图地址:{thumb($字段名, 100, 100)} 缩略图带上水印地址:{thumb($字段名, 100, 100, 1)} 强制高度、强制宽度:{thumb($...