I'm developing an app and I need to retrieve data from html code. In addition, i would like manage the event (for example, click the button and redirect in other page) in html code.
I searched on Google and I've found a beautiful library that meet my needs: HtmlUnit.
The problem is the compatibility with Android SDK: there are conflicts with Android classes and maybe, I must to recompile the source code for Android compatibility.
Are there alternative to HtmlUnit? I don't know how to build this library...Can you help me?
The bad news is that HtmlUnit uses Java classes that are not available on Android. These are the AWT, Swing and ImageIO classes that came to my mind; there may be other APIs I'm not thinking of:
On top of that, HtmlUnit uses a bunch of other libraries, some of which may have their own dependencies on these libraries. So, as awesome as HmlUnit is, I think getting it to run on Android may not be an easy task.
Post by:Roberto Tucci
Thanks for your reply!
So, I understood. Mmm...is not an easy task.
According to you, are there similar alternative to HtmlUnit? Mainly, I need to get html and simulate a button click...
Post by:Ulf Dittmer
If this is one specific web page in which you need to simulate one specific action, you might use Android's built-in HttpClient library. It's fairly easy to code up a form submission with that.
If you need more flexibility (several forms, data extraction from the web page, different web pages, etc.) you could run HtmlUnit as part of a Java web app, and have the Android app communicate with it over a REST API. That might be way over-engineered, depending on your requirements.
This thread has been viewed 3625 times.
All times above are in ranch (not your local) time.
The current ranch time is Sep 25, 2018 14:33:38.