java-如何从文本文件中获取特定行到一行并在android中显示数组列表

我有一个文本文件,并且能够读取全部内容并将其显示在视图上.
文本文件的示例格式示例:-

## userdetail 

   [William]
   [Bits]
   6th cross road, City house.
   Rio.
   <051-22345690>|<002-22345690>

## calldetails

    income 22.
    out going 24.
    missed 21.


## Lorempsum
 Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
 Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
 when an unkNown printer took a galley of type and scrambled it to make a type specimen book 


## userot 
 It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.                  

………..
………..
………..

喜欢更多50条线

但是我的要求是我需要从字段名称获取特定数据.我可以获取所有唯一ID的“ ## userot”值.但是我需要没有哈希映射的中间数据的详细信息.
有时数据也位于下一行.我的意思是,在某些情况下,我有5行,
在另一行中有10行文字.因此,我需要“ ##”下面的所有行,直到下一个“ ##” –

朋友请给我解决办法吗?

解决方法:

下面的解决方案是找到’## userot’之后的所有行,直到下一个##

FileInputStream fileIn = openFileInput("mytextfile.txt");
InputStreamReader inputRead = new InputStreamReader(fileIn);
BufferedReader reader = new BufferedReader(inputRead);

while ((str = reader.readLine()) != null){
    if(str.contains("##") && str.contains("userot"){
        while ((str = reader.readLine()) != null){
            if(str.contains("##"))
              break;
            else
              Log.d("TAG","output: " + str);
        }
        break;
     }
}

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...