Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.os.Environment;

import java.io.BufferedReader;
import java.io.File;

import java.io.FileReader;

public class Main {
    public static String readFromSD(String fileName) throws Exception {
        File file = new File(Environment.getExternalStorageDirectory(), fileName);

        FileReader fr = new FileReader(file);
        BufferedReader br = new BufferedReader(fr);
        String line = null;
        StringBuilder sb = new StringBuilder();

        while ((line = br.readLine()) != null) {
            sb.append(line);
        }
        return sb.toString();
    }
}