Skip to main content

Posts

Showing posts from November, 2019

ListView Example in Kotlin

ListView Example in Kotlin Listview is used to display array data in vertical  scrollable  list format activity_main.xml In activity_main.xml we have created an listview  <? xml version= "1.0" encoding= "utf-8" ?> < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" xmlns: app = "http://schemas.android.com/apk/res-auto" android :layout_width= "match_parent" android :layout_height= "match_parent" tools :context= ".MainActivity" android :orientation= "vertical" > < ListView android :layout_width= "match_parent" android :layout_height= "wrap_content" android :id= "@+id/listview" > </ ListView > </ LinearLayout > MainActivity.kt In MainActivity.kt w...

Alert Dialog in Kotlin

 Alert Dialog in Kotlin activity_alert_dialog_example.xml This activity activity_alert_dialog_example.xml we are creating a button which on click will display the alert dialog <? xml version= "1.0" encoding= "utf-8" ?> < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" xmlns: app = "http://schemas.android.com/apk/res-auto" android :layout_width= "match_parent" android :layout_height= "match_parent" tools :context= ".AlertDialogExample" android :orientation= "vertical" > < Button android :layout_width= "match_parent" android :layout_height= "wrap_content" android :id= "@+id/alertButton" android :text= "Alert Dialog Example" /> </ LinearLayou...

How to pass values from one activity to another activity in Kotlin

How to pass values from one activity to another activity in Kotlin In previous article we have discussed on what is Intent and types of intent  check on this link if required    Intent and is type with example   this will be continued article of previous  activity_first.xml In this activity_first.xml file we are creating an button which on click will send data from current activity to another specified activity <? xml version= "1.0" encoding= "utf-8" ?> < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" xmlns: app = "http://schemas.android.com/apk/res-auto" android :layout_width= "match_parent" android :layout_height= "match_parent" tools :context= ".FirstActivity" android :orientation= "vertical" > < Button android :layout_width= ...

Intent in Android with Example using Kotlin

                            Intent in Android using Kotlin What is Intent ? Intent is a messaging object used to request an action from application components like activity, service, broadcast receiver There are 2 types of Intents Explict Intent Implict Intent Explict Intent Explict intents are used to switch between the activities , it can also pass data from one activity to another. activity_first.xml <? xml version= "1.0" encoding= "utf-8" ?> < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" xmlns: app = "http://schemas.android.com/apk/res-auto" android :layout_width= "match_parent" android :layout_height= "match_parent" tools :context= ".FirstActivity" android :orientation= "vertical" > < Button android :layout_wid...