{"id":3501,"date":"2020-07-11T11:52:55","date_gmt":"2020-07-11T16:52:55","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=3501"},"modified":"2020-07-11T12:53:03","modified_gmt":"2020-07-11T17:53:03","slug":"kotlin-buttons-and-textviews","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/kotlin-buttons-and-textviews\/","title":{"rendered":"Kotlin &#8211; Buttons and TextViews"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Set Text for text view<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">val textBoxVar: TextView = findViewById(R.id.<em>textBoxID<\/em>)\ntextBoxVar.<em>text <\/em>= \"Hello World!\"<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Button clicked &#8211; do something<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">val buttonVar: Button = findViewById(R.id.<em>buttonID<\/em>)\nbuttonVar.setOnClickListener <strong>{<\/strong>\n    buttonVar.<em>text <\/em>= \"Button Pushed...\"  \/\/Change text on button\n\n<strong>}<\/strong><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Toast notification<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">val text = \"Hello World! This is a toast message!\"\nval duration = Toast.<em>LENGTH_SHORT\n<\/em>val toast = Toast.makeText(<em>applicationContext<\/em>, text, duration)\ntoast.show()<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Set Text for text view val textBoxVar: TextView = findViewById(R.id.textBoxID) textBoxVar.text = &#8220;Hello World!&#8221; Button clicked &#8211; do something val buttonVar: Button = findViewById(R.id.buttonID) buttonVar.setOnClickListener { buttonVar.text = &#8220;Button Pushed&#8230;&#8221; \/\/Change text on button } Toast notification val text = &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/kotlin-buttons-and-textviews\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[540],"tags":[541,649,1064,606,1065,1067,1066],"class_list":["post-3501","post","type-post","status-publish","format-standard","hentry","category-android","tag-android","tag-button","tag-kotlin","tag-programming","tag-text","tag-textbox","tag-textview"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=3501"}],"version-history":[{"count":4,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3501\/revisions"}],"predecessor-version":[{"id":3505,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3501\/revisions\/3505"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=3501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=3501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=3501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}