Android Loading images to Recycler View

In this tutorial i will give you instructions of loading images in a recycler view using Picasso library. One you complete this tutorial your application will look like this.
Screenshot_2016-06-17-10-26-06

This application will list image of the android versions and its version names. OK. lets get started.

1. Create a new project.

Open up your android studio and create a new project with the name Recyclerimage. Note you can give any name you like, but for this tutorial i suggest using the same name.

2.  Create a layout for the recycler view.

Inside your res/layout/ folder create a new file called row_layout.xml . This file will have a simple image view and a text view and copy and paste the below code.

Then add a recycler view to your activity_main.xml as shown in below code. Make sure to change your tools:contex property according to your project package name.

3. Add permissions to Android manifest.

This application need internet connection to download images from URL, therefore it is necessary to add request the internet permission through your AndroidManifest.xml file as shown in the below code.

4. Creating data adapter.

Now create a new java class called DataAdapter.java inside your package and then copy and paste the below code.

Make sure to change the package name according to your project.

Now create another class inside your package and name it as AndroidVersion.java and then copy and paste the blow code.

Make sure to change the package name.

Now lets modify the MainActivity.java class to get the list of images and strings to add it in to the recycler view.

5. Modify compile dependencies in your Build.gradle file.

That’s it. Save the project and run it on your device or emulator. It should work fine. If you have any comments or queries leave it in the comments section below.  Thank you. Happy coding 🙂