=0){result+=f.getPath()+"";}}if(result.equals(""))result="找不到文件!!";returnresult;-IMDN开发者社群-imdn.cn"> =0){result+=f.getPath()+"";}}if(result.equals(""))result="找不到文件!!";returnresult; - IMDN开发者社群-imdn.cn">
登录
首页 » Android » Android indexOf搜索文件示例

Android indexOf搜索文件示例

于 2023-07-23 发布 文件大小:7.60 kB
0 167
下载积分: 2 下载次数: 1

代码说明:

Android 系统中搜索文件的一个简单例子,功能和Windows搜索文件相似,不过实现上就差别大了:先载入main.xml Layout ,初始化对象:   mKeyword=(EditText)findViewById(R.id.mKeyword);   mButton=(Button)findViewById(R.id.mButton);   mResult=(TextView) findViewById(R.id.mResult);   然后定义一个方法,将mButton添加onClickListener,取得输入的关键字,再创建搜索文件的method:   private String searchFile(String keyword)   {    String result="";    File[] files=new File("/").listFiles();    for( File f : files )    {    if(f.getName().indexOf(keyword)>=0)    {    result+=f.getPath()+" ";    }    }    if(result.equals("")) result="找不到文件!!";    return result;

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • android 选择地区 省、市、县三级联动源码(自定义view控件 WheelView滚轮)
    android 选择地区 省、市、县三级联动源码(自定义view控件 WheelView滚轮)
    2015-06-26下载
    积分:1
  • draw
    此源码是一个可以在android手机上实现以动画的形式画图的一个demo(This source is a form of animation drawing a demo on the android phone)
    2013-05-17 11:13:10下载
    积分:1
  • viewpage_fragment
    Viewpage_Fragment 很不错的android多页面滑动效果实例,完整的Java源代码,创建时间:2013-8-2 下午4:56:15 ,基于android.support.v4.app.Fragment实现 让页面list,页面title list,滑动显示,在代码中定义适配器,得到每个页面,每个页面的title,得到页面的总个数,根据这些信息实现多页面的滑动。(Viewpage_Fragment very good android multi-page sliding effect instance, a complete Java source code, creation time :2013-8-2 4:56:15 pm based android.support.v4.app.Fragment achieve make the page list, the page title list, slide shows, adapters defined in the code, to get each page, each page s title, to get the total number of pages, according to the information page of multi-slide.)
    2013-09-22 22:05:23下载
    积分:1
  • asmack-android-6.jar
    说明:  smack是一套很好的开源即时通讯api,是基于Xmpp协议的实现,而在Android,则提供了一个asmack的jar包,其功能以及用法跟smack一致。(Smack is a good open source instant messaging api, based on the implementation of Xmpp protocol, while Android provides an asmack jar package, which functions and uses the same as smack.)
    2020-06-17 22:20:01下载
    积分:1
  • Viterbi-Vifekbi-This
    说明:  强烈推荐好用的卷积码编码,维特比译码和软判决,本代码简易可行,(Good convolutional code coding, Viterbi decoding and soft decision are highly recommended. This code is simple and feasible.)
    2019-03-28 00:21:41下载
    积分:1
  • android HerilyAlertDialog完全自定义的Dialog
    android HerilyAlertDialog完全自定义的Dialog
    2014-08-21下载
    积分:1
  • android 页面切换以及底部导航栏
    android可视化界面,可来回切换页面 0轻便快捷,切换时底部导航栏可随之变色,仿同城交友APP,底部有首页,动态,消息,我四个布局,界面友好可拓展
    2022-07-02 11:55:10下载
    积分:1
  • 史上最好用的AndroidPlayer(仿酷狗播放器)
    应用背景史上最好用的AndroidPlayer(仿酷狗播放器):这里面是本人结合网上案例,自己写的一套仿酷狗音乐播放器的Android应用软件,欢迎大家下载,交流关键技术史上最好用的AndroidPlayer(仿酷狗播放器):主要运用的Java+css3+jQuery+ajax+div+css的综合运用,界面和真正的酷狗音乐平台一样。
    2022-11-03 04:15:03下载
    积分:1
  • bms(终版)
    实现WIFI环境下的以太网通信,在手机上监控BMS的运行参数(Realize the Ethernet communication in WIFI environment, monitor the operation parameters of BMS on the mobile phone)
    2017-11-23 13:17:13下载
    积分:1
  • seekbar_Android开发实例
    代码实现了的进度条1进度条如线状显示,带有少许发散效果2拖拽按钮用圆显示,采用发散效果。(类似太阳的效果) 这个效果主要有这样几个难点:进度条的高度会随着seekbar的宽度变化,然而seekbar宽度过小又会遮罩住部分拖拽按钮;拖拽按钮使用shape方式生产,而非图像~~~~ 折腾折腾...
    2022-07-04 02:16:20下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载