• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

ANDROID KOTLIN GET HTML SOURCE FROM URL

  • Thread starter Thread starter HyMyNameIs115
  • Start date Start date

I would like to get Source from URL

  • Kotlin

    Votes: 0 0.0%
  • Android

    Votes: 0 0.0%

  • Total voters
    0
H

HyMyNameIs115

Guest
Hello.
I would like to get HTML code from URL with Ion library, but when I clicked the button the application thrown out.
Here is the code somebody, please help me
If the application makes the HTML I would like to save this file automatically:

class MainActivity : AppCompatActivity() {
var button1: Button? = null
var text1: TextView? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

button1 = findViewById<Button>(R.id.button1) as Button
text1 = findViewById<TextView>(R.id.text1) as TextView

button1.setOnClickListener{
Ion.with(applicationContext)
.load("http://protondrive.com")
.asString()
.setCallback {e,result -> text1!!.text = result }

}

}
}
 
Back
Top Bottom