try{
InputStream myInput = mcontext.getResources().openRawResource(R.raw.medicalspeciality);
InputStreamReader reader = new InputStreamReader(myInput);
BufferedReader breader = new BufferedReader(reader);
String str;
FileWriter myOutput = new FileWriter(outFileName, true);
while ((str = breader.readLine()) != null) {
System.out.println(i+++str);
}
// Close the streams
myOutput.flush();
myOutput.close();
myInput.close();
}catch (Exception e) {
// TODO: handle exception
e.getStackTrace();
}