Using java Syntax Highlighting
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import android.os.Environment;
- import android.util.Log;
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
i read a file named "filename.txt" put in the root of the sdcard (I pushed the file using Eclipse in the "sdcard" directory on the phone)
Using java Syntax Highlighting
- try{
- File f = new File(Environment.getExternalStorageDirectory()+"/filename.txt");
- fileIS = new FileInputStream(f);
- BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS));
- String readString = new String();
- //just reading each line and pass it on the debugger
- while((readString = buf.readLine())!= null){
- Log.d("line: ", readString);
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e){
- e.printStackTrace();
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4




