Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import android.os.Environment; public class Main { public static final String CUST_PATH = Environment.getExternalStorageDirectory() + File.separator + "chcconf" + File.separator; public static final String VIDEO_CHANNEL_FILE_NAME = "video_channel.txt"; public static String getVideoChannelName() { File f = new File(CUST_PATH + VIDEO_CHANNEL_FILE_NAME); if (f.isFile()) { String result = null; BufferedReader br = null; try { br = new BufferedReader(new FileReader(f)); result = br.readLine(); } catch (FileNotFoundException e) { // Log.e(CHCCustomUtil.class.getName(), "Organization channel file not found!", e); } catch (Exception e) { } finally { if (br != null) try { br.close(); } catch (Exception e) { } } if (result != null) return result; else return new String(); } else return new String(); } }