0

I have text file a.txt and I want to a methode like public String[] getdata(String filename,int nbrLine){} that I give two parameters the name of the file (a.txt) and the number of the line that I want to put in String[].

I have text file a.txt

1,2,3,5,0
7,2,3,5,4,7
9,2
1,0,0,2`

I try something like

public String LoadDataB(String inFile) {
     String tContents = "";
     try {
         InputStream stream = getAssets().open(inFile);
         byte[] buffer = new byte[stream.available()];
         stream.read(buffer);
         stream.close();
         return new String(buffer);
     } catch (IOException e) {
         return tContents;
     }
 }

But how can I complete it?

mnille
  • 1,328
  • 4
  • 16
  • 20
ali
  • 33
  • 4

0 Answers0