Advertisement
darryljf

SearchURLupdated.kt

Jun 20th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.70 KB | None | 0 0
  1. class MainActivity : AppCompatActivity() {
  2.     private var urlView: TextView? = null
  3.     private var userInput: EditText? = null
  4.     private var searchButton: Button? = null
  5.     private var url: String="http://api.tvmaze.com/search/shows?q="
  6.  
  7.     override fun onCreate(savedInstanceState: Bundle?) {
  8.         super.onCreate(savedInstanceState)
  9.         setContentView(R.layout.activity_main)
  10.         userInput = findViewById<EditText>(R.id.searchText)
  11.         urlView = findViewById<TextView>(R.id.urlView)
  12.         searchButton = findViewById<Button>(R.id.searchBtn)
  13.  
  14.         searchButton?.setOnClickListener {
  15.             url += userInput.toString()
  16.                 urlView?.text = url
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement