RecyclerView-in-Kotlin

in #kotlin7 years ago

#RecyclerView-in-Kotlin

#Creating a new Android Project with Kotlin in Android Studio.

#Add Dependencies in build.gradle file

//picasso is an image loading/processing library
implementation 'com.squareup.picasso:picasso:2.71828'

//Retrofit Networking library
implementation "com.squareup.retrofit2:retrofit:2.3.0"

//Gson is a library that can be used to convert Java Objects into their JSON representation
implementation "com.squareup.retrofit2:converter-gson:2.3.0"

//RecyclerView
implementation 'com.android.support:recyclerview-v7:27.1.1'

#Adding User Interface in your main Layout file

<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"/>

#Create a single row item for your RecyclerView.

#Create a Model Class

#Create a Adapter class

Here, I created a custom adapter name MovieAdapter with ViewHolder.

The Holder contains the members of the layout to bind viewItems.

HereI used Picasso library for image loading.
Picasso.get().load(movieModel.image).into(itemView.imageView_movie)

#Creating RecyclerView And Set Data To Adapter Class

var linearLayoutManager = LinearLayoutManager(this)
var adapter = MovieAdapter(arrList)
recyclerView.layoutManager = linearLayoutManager
recyclerView.adapter = adapter

#You can access full code please visit below link
https://github.com/bkotagonde/RecyclerView-in-Kotlin/tree/master
Screenshot_20180520-152947.png

Sort:  

This post received a $0.223 (34.94%) upvote from @upvotewhale thanks to @basav! For more information, check out my profile!

Congratulations @basav! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard!


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @basav! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Sweden vs Switzerland


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @basav! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemFest³ - SteemitBoard support the Travel Reimbursement Fund.

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @basav! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 6000 upvotes. Your next target is to reach 7000 upvotes.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

The Meet the Steemians Contest is over - Results are coming soon ...

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @basav! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 7000 upvotes. Your next target is to reach 8000 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Christmas Challenge - The party continues

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @basav! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!