I'm creating an application that will take the div of this page https://gyp.ch/ecran/ to show it.
I tried to find a way to getElementByID with Kotlin but I don't think it's possible because of JVM.
logo.setOnClickListener {
"https://gyp.ch/ecran/".httpGet().responseString{request,response,result ->
profs.text = result.get()
}
}
It just displays the result.get() so in this case the code source of the link above.
Since you are using kotlin you can easily add jsoup
to your project.
implementation 'org.jsoup:jsoup:1.11.3'
simple example -
Document doc = Jsoup.connect("https://gyp.ch/ecran/").get();
log(doc.title());
Elements allDivs = doc. getElementsByTag("div");
for (Element div : allDivs) {
div.text()
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.