I need to download an HTML page programmatically and then get its HTML. I am mainly concerned with the downloading of the page. If I download the page, where will I put it?
Will I have to keep in an String variable? If yes then how?
Android phone or tablet using ChromeOpen the Google Chrome browser on your Android phone or tablet. Open the web page whose source code you want to view. Tap once in the address bar and move the cursor to the front of the URL. Type view-source: and tap Enter or Go.
You can also right-click anywhere on the page and select Save as or use the keyboard shortcut Ctrl + S in Windows or Command + S in macOS. Chrome can save the complete web page, including text and media assets, or just the HTML text.
1: To add a local HTML file into your Android project there must be an asset folder in it. To create an asset folder in Android studio open your project in Android mode first as shown in the below image. 2: Go to the app > right-click > New > Folder > Asset Folder and create the asset folder.
This site provides a good explanation on how to download a file, and also how to set the location to where it should be stored. You do not have to, and should not, keep it in a string variable. If you are to manipulate the data I would suggest you use an XML parser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With