Answer the question
In order to leave comments, you need to log in
Why does jsoup return an empty string?
Hello, I'm testing jsoup on Android:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var str:String=""
val t1=Thread {
var url=" https:/ /site.ru "
var doc = Jsoup.connect(url).userAgent("Chrome/4.0.249.0 Safari/532.5").referrer(" www.coocle.com ").get()
str=doc.title()
}
t1.start()
textV1.setText(str)
}
Internet is allowed in the manifest, str is empty as a result. What could be the problem, in the logs, in my noobish opinion, nothing.
Answer the question
In order to leave comments, you need to log in
You start a new thread, get something and don't show it anywhere. The fact that you use str immediately after the start of the thread does not mean anything, TK, of course, it has not yet managed to go online.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question