Skip to main content

Posts

Showing posts with the label Summary

Android Kotlin: Toolbar back button example

Toolbar Back Button The following kotlin tutorial will demonstrate to us how we can show a back button on the Toolbar and how we can navigate back to the previous activity using the Toolbar back button click event in an android application. To do this we selected an android theme that has an ActionBar. We create two Activity screens so that we can navigate between them. The first Activity is the main activity. In this main activity kotlin file, we called the support ActionBar and set a title for it.We also put a Button widget on this main activity and we navigate to the second activity using its click event. The Intent is used to navigate from the main activity to the other activity. We created another Activity named the second activity. We navigate this activity from the main activity using the main activity Button’s click event. But how can we navigate from the second activity to the main activity because in this second activity we don’t pla...

Android Kotlin: How to implement ListView OnItemClickListener

ListView Item Click Listener ListView allows us to display a vertically scrollable collection of views, primarily a simple view with some short text. Views are shown sequentially one after another. ListView is used to display a simple list of some text such as a color list, customer name list, user list, etc. A ListView is an adapter view that does not know the type and content of views. Instead, ListView requests views on demand from the list adapter. In order to display items in a list, we need to specify a list adapter. In this example, we used an array adapter to populate the list view with items. Our main goal is to set a click listener for each of the items of the list view widget. So that, we can get the item clicked from the ListView widget and display more details about that item to our app user. In this tutorial, we used Kotlin as our programming language to write our android application script. To achieve list view item cl...