Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.myapplication
- import android.os.Bundle
- import android.support.v7.app.AppCompatActivity
- import android.widget.TextView
- import java.net.URL
- const val url = "https://www.dropbox.com/s/4zp7dhso5a35zh4/%D0%A2%D0%B5%D0%BA%D1%81%D1%82%20%D1%86%D0%B8%D1%82%D0%B0%D1%82%D1%8B.txt?dl=1"
- class MainActivity : AppCompatActivity() {
- val title by lazy { findViewById(R.id.title) as TextView }
- override fun onCreate(savedInstanceState: Bundle?) = async {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
- title.text = try {
- await(URL(url).readTextAsync())
- } catch (e: Exception) {
- e.message
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement