0

How can I read a file from Assets a file dir which is made by me in Android application?

2 Answers 2

2

Try this...

 try { InputStream in = getAssets().open("EULA.txt"); if (in != null) { in = getAssets().open("EULA.txt"); int siz = in.available(); byte[] buffer = new byte[siz]; in.read(buffer); result = new String(buffer); in.close(); } } catch(Exception e) { } 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot ,this i can do it ,but while i create a file dir and put one file in it ,i can not read this file .
You can do like this InputStream in = getAssets().open("YourFolder/EULA.txt");
1

try using like this

InputStream myInput = this.getAssets().open("your_dir/yourfilename"); 

2 Comments

let me have a try ,Thanks a lot
if it is solved your problem then accept the answer, then only others will use this answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.