How to read .txt file from drawable or any other folder in android using FileInputStream?
I have a .txt file in my drawable folder. How can i read the file and set it in Textview?
How to read .txt file from drawable or any other folder in android using FileInputStream?
I have a .txt file in my drawable folder. How can i read the file and set it in Textview?
Try This with help of this u can read file from drawable folder
String data = "";
StringBuffer sbuffer = new StringBuffer();
InputStream is = this.getResources().openRawResource(+
R.drawable.filetoread);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
if (is != null) {
try {
while ((data = reader.readLine()) != null) {
sbuffer.append(data + "\n");
}
is.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
data = sbuffer.toString(),
}