Adding a RecyclerView with grid layout in android

This post describes a simple RecyclerView added as a Fragment in MainActivity. 1. Create main.xml. In main.xml add a ToolBar in AppBarLayout, and then add a LinearLayout containing a FrameLayout. 2. In MainActivity.java display ToolBar, enable back button on toolbar, and create fragment transaction to display fragment. 3. Create recycle_view_frag.xml containing a RecyclerView. This will … Read more

GridView with Image and Text

This tutorial shows how to display a Map List containing texts and images in a Custom GridView. Step 1: Create a new project with name GridViewExample and package name com.myexample.gridview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a GridView. Step … Read more

GridView Example

This tutorial shows how to display a String list in a GridView. Step 1: Create a new project with name GridView and package name com.myexample.gridview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a GridView mainGridView1. Step 3: Open app/src/main/java/package and open … Read more

Expandable ListView Example

This tutorial shows how to display a HashMap with String and ArrayList<String> as key value pairs, in an ExpandableListView. Step 1: Create a new project with name ExpandableListView and package name com.myexample.listview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add an … Read more

Custom ListView with BaseAdapter for displaying Map List

This tutorial shows how to display a Map List containing text and images in a Custom ListView. Step 1: Create a new project with name ListViewExample and package name com.myexample.listview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a ListView mainListview1. … Read more

Custom ListView with images

This tutorial shows how to display a String list and a list of images in a Custom ListView. Step 1: Create a new project with name ListViewExample and package name com.myexample.listview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a ListView … Read more

Custom ListView for String List

This tutorial shows how to display a String list in a Custom ListView. Step 1: Create a new project with name ListViewExample and package name com.myexample.listview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a ListView mainListview1. Step 3: In res/layout/ … Read more

ListView Example

This tutorial shows how to display a String list in a ListView. Step 1: Create a new project with name ListViewExample and package name com.myexample.listview. Select File/New/New Project. Fill the forms and click “Finish” button. Step 2: Open res/layout/xml (or) main.xml and add following code. Here we add a ListView mainListview1. Step 3: Open app/src/main/java/package and open … Read more