I
I
IA-NE-ROBOT2019-11-01 17:26:39
Android
IA-NE-ROBOT, 2019-11-01 17:26:39

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

1 answer(s)
D
Denis Zagaevsky, 2019-11-01
@IA-NE-ROBOT

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 question

Ask a Question

731 491 924 answers to any question