In my android app(using Eclipse), I have a link where the user clicks on and it downloads a word document. Instead I want it so when the user clicks on the link, it displays the word file(text) on the application it self. Please help! THANKS!
Asked
Active
Viewed 76 times
1 Answers
1
Assuming the word document is online, you first need to add internet permission to your Manifest file.
After that, you can use HttpURLConnection
to get the file. Then, use InputStream
to read the file, and ByteArrayOutputStream
to write the file to your textview.
Here is an example: https://stackoverflow.com/a/17141903/4195406
-
Well, yes the word document is online. I am using web view to display the website which has all my documents. So so far in my app, a user clicks on a button which then takes them to a new screen where it shows my website with all my document links. Although, when they click on the doucment it downloads it, so instead i want it so when they click on it, it just views in the app. Could you give me source code example? please and thank you! – Kobe Nov 04 '14 at 02:06
-
http://android-er.blogspot.com/2011/04/read-text-file-from-internet-using-java.html This one should be a good example. – ztan Nov 04 '14 at 17:00