Click to Open Details
This lesson will teach you how to add click listener to the list item.
We'll cover the following
Details screen changes #
The very first thing we need to do is to update the details screen. Instead of loading blog details again, we can just pass the data from the MainActivity
to the BlogDetailsActivity
via the intent bundle.
Let’s remove the loadData
method and instead, call the showData
method. To get Blog
from the parameter we need to:
- (1) acquire reference to the Intent object via
getIntent
method (object which was used to launch this Activity) - (2) retrieve Bundle object from the Intent via
getExtras
method (object which contains some data carried by Intent) - (3) retrieve the
Blog
object from the Bundle viagetParcelable
method passing the String key as a parameter
Get hands-on with 1400+ tech skills courses.