Create RecyclerView Text View with code 6x6

   


Example 1

If the JSON data describes an array, and each element of that array is an object:

[
  {
    "id": 1,
    "discipline": "BCS-2E",
    "starttime": "08:30",
    "endtime": "10:00",
    "day": "Monday",
    "courseCode": "ENG325",
    "courseName": "CPS",
    "venue": "Lt3",
    "teacherName": "Naeem",
    "sessionId": "5",
    "sessionName": null
  },
  {
    "id": 103,
    "discipline": "BCS-2D",
    "starttime": "10:00",
    "endtime": "11:30",
    "day": "Tuesday",
    "courseCode": "CS400",
    "courseName": "DBS",
    "venue": "Lab6",
    "teacherName": "Abdul Rehman",
    "sessionId": "5",
    "sessionName": null
  },
  {
    "id": 214,
    "discipline": "BAI-3A",
    "starttime": "11:30",
    "endtime": "01:00",
    "day": "Wednesday",
    "courseCode": "CS632",
    "courseName": "AI",
    "venue": "Lab6",
    "teacherName": "Dr. Sadaf,Rifhat",
    "sessionId": "5",
    "sessionName": null
  },
   {
    "id": 326,
    "discipline": "BIT-8B",
    "starttime": "01:30",
    "endtime": "03:00",
    "day": "Thursday",
    "courseCode": "ENG315",
    "courseName": "TBW",
    "venue": "Lt12",
    "teacherName": "Sumaira",
    "sessionId": "5",
    "sessionName": null
  },
  {
    "id": 439,
    "discipline": "BCS-2B",
    "starttime": "03:00",
    "endtime": "04:30",
    "day": "Friday",
    "courseCode": "MTH315",
    "courseName": "MVC",
    "venue": "Lt5",
    "teacherName": "Shahid Rasheed",
    "sessionId": "5",
    "sessionName": null
  }
]

the JSON Data Set will create a row for each object in the array, and each property on the object will become a column. 

code XML Show Recycler View:

Background XML Design Code :

 

code Recycler View Cell Design:

 Recycler View Java Class Code : 

This is an Android RecyclerView adapter written in Java programming language. The adapter displays a timetable schedule with days of the week as columns and time slots as rows. Each cell in the table represents a particular class with information such as the course name, course code, instructor name, and venue.

The adapter has two constructors, the first one takes an ArrayList of TimeTable objects and a context, while the second one takes two ArrayLists of TimeTable objects and a context. The TimeTable object represents a single class in the schedule. The first constructor is used to display the complete timetable schedule, while the second constructor is used to display a filtered timetable schedule based on some user input.

The adapter creates a RecyclerView.ViewHolder that holds the RecyclerviewTimetableScheduleCellBinding object, which contains the layout for each cell in the timetable schedule. The onBindViewHolder method is used to bind the data to the view holder. The RecyclerView is populated by iterating through the start times of each class in the schedule, and for each start time, a row is created with cells representing each day of the week.

The adapter uses a linear layout to display the days of the week at the top of the timetable schedule. The start time and end time are displayed in the first cell of each row, and the cells representing each day of the week are displayed next to the start time and end time cell. The cells are created dynamically using TextView objects, and each cell is set with appropriate values from the TimeTable object.

Overall, this adapter is used to display a timetable schedule in a RecyclerView in an Android app. It is written in Java and uses the Android SDK to create the user interface.



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.