Monday, January 30, 2012

How to read Read Asset file?


public static String ReadFromAssetFile(Context context,String filenames)
{
String content = "";

InputStream inputStream = null;
try {
inputStream = context.getAssets().open(filenames);
BufferedReader readerRead1 = new BufferedReader(new InputStreamReader(inputStream));
String line="";
while((line=readerRead1.readLine())!=null){
content+=line.trim();
}
} catch (IOException e1) {
// TODO Auto-generated catch block
return content;
}


return content;
}

No comments:

Post a Comment