摘要: [1].[代码]删除保存于手机上的缓存.跳至[1][2][3]01// clear the cache before time numDays02privateintclearCacheFolder(File dir,longnumDays) {03intdeletedFiles =0;04if(dir!=null&& dir.isDirectory()) {05try{06for(File child:dir.listFiles()) {07if(child.isDirectory()) {08deletedFiles += clearCacheFolder(child, n 阅读全文
posted @ 2013-07-12 11:45 skyyhu 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 01publicvoidsetListViewHeightBasedOnChildren(ListView listView) {02ListAdapter listAdapter = listView.getAdapter();03if(listAdapter ==null) {04return;05}0607inttotalHeight =0;08for(inti =0; i 08152324[3].[图片]scrollview_listview.jpg跳至[1][2][3][4] 阅读全文
posted @ 2013-07-12 10:59 skyyhu 阅读(494) 评论(0) 推荐(0) 编辑
摘要: //打开本包内asset目录下的index.html文件wView.loadUrl(" file:///android_asset/index.html "); //打开本地sd卡内的index.html文件wView.loadUrl("content://com.android.htmlfileprovider/sdcard/index.html");//打开指定URL的html文件wView.loadUrl(" http://m.oschina.net"); 阅读全文
posted @ 2013-07-12 10:54 skyyhu 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 在android中的文件放在不同位置,它们的读取方式也有一些不同。本文对android中对资源文件的读取、数据区文件的读取、SD卡文件的读取及RandomAccessFile的方式和方法进行了整理。供参考。一、资源文件的读取: 1) 从resource的raw中读取文件数据:[java]view plaincopyStringres="";try{//得到资源中的Raw数据流InputStreamin=getResources().openRawResource(R.raw.test);//得到数据的大小intlength=in.available();byte[]buff 阅读全文
posted @ 2013-07-12 10:13 skyyhu 阅读(215) 评论(0) 推荐(0) 编辑