Hi guys in this tutorial we will continue the customize of the listview.
In my previous article, we started to customize listview. First of all, I recommend you to read it. You can read it here.
Today, we will define the model class we will use when creating an arraylist . In the example we made before, we define the arraylist as arraylist<string>. And so we add string-like values when adding elements to the arraylist. When we want to customize the listview, we create listview with the new class type.
package com.example.teka.icim_rahat.models; /** * Created by teka on 17.7.2017. */ public class il_isteclass { public String il; public String ilce1; public String ilce2; public String ilce3; public il_isteclass(){ } public il_isteclass(String Il){ il=Il; } public il_isteclass(String Il,String Ilce1){ il=Il; ilce1=Ilce1; } public il_isteclass(String Il,String Ilce1,String Ilce2){ il=Il; ilce1=Ilce1; ilce2=Ilce2; } public il_isteclass(String Il,String Ilce1,String Ilce2,String Ilce3){ il=Il; ilce1=Ilce1; ilce2=Ilce2; ilce3=Ilce3; } public String getIl() { return il; } public void setIl(String il) { this.il = il; } public String getIlce1() { return ilce1; } public void setIlce1(String ilce1) { this.ilce1 = ilce1; } public String getIlce2() { return ilce2; } public void setIlce2(String ilce2) { this.ilce2 = ilce2; } public String getIlce3() { return ilce3; } public void setIlce3(String ilce3) { this.ilce3 = ilce3; } }
when we examine the example;
First of all, we define the variable of our classwith their types. Then we create the constructive functions of the class. We create two constructive functions together with an empty constructor and a constructor with all variables. Finally, we create the get and set functions for each variable.