Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;

import java.io.IOException;
import java.io.InputStreamReader;

import android.content.Context;

import android.util.Log;

public class Main {
    public static String readInternalFileContent(Context content, String fileName) {
        String file = new String(), tmp;
        try {
            // Read the file
            BufferedReader bf = new BufferedReader(new InputStreamReader(content.openFileInput(fileName)));
            while ((tmp = bf.readLine()) != null) {
                file += tmp;
            }
            bf.close();
        } catch (IOException e) {
            Log.e("JSO reading", "Error reading the file " + fileName + "\n" + e.getMessage());
        }
        return file;
    }
}