read one Line from a text file - Android File Input Output

Android examples for File Input Output:Text File

Description

read one Line from a text file

Demo Code


//package com.java2s;
import java.io.BufferedReader;

import java.io.FileReader;
import java.io.IOException;

public class Main {
    private static String readLine(String filename) throws IOException {
        BufferedReader reader = new BufferedReader(
                new FileReader(filename), 256);
        try {//from w w  w  .  j  a va 2 s .  co  m
            return reader.readLine();
        } finally {
            reader.close();
        }
    }
}

Related Tutorials