Lab Detail


Sno Back Back Subject subject date title note
1 1 Back to subject Mobile Application Development Lab - 20A05706 (Lab) Sept. 4, 2025 Port02 Do CURD Operation Using API Via Android sdk show Data from Server Send Points Register Via API,/POST Login Via API/POST Contact address API/GET

https://www.jsonschema2pojo.org/

https://androindian.com/

 

E:\android\android apps\APIIntegration\app\src\main\AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.APIIntegration"
        tools:targetApi="31">
        <activity
            android:name=".MenuPage"
            android:exported="false" />
<!--        <activity-->
<!--            android:name=".DashBoard"-->
<!--            android:exported="false" />-->
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity> <!-- Declare your activities here -->
        <activity android:name=".Login" />
    </application>

</manifest>

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\ConnectionChecking.kt

package com.example.apiintegration

import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.os.Build

class ConnectionChecking {

    fun isConnectingToInternet(context: Context): Boolean {
        val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            val network = connectivityManager.activeNetwork ?: return false
            val networkCapabilities = connectivityManager.getNetworkCapabilities(network) ?: return false
            return networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
        } else {
            val networkInfo = connectivityManager.activeNetworkInfo
            return networkInfo != null && networkInfo.isConnected
        }
    }
}

 

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\CustomAdapter.kt

package com.example.apiintegration
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
//import com.squareup.picasso.Picasso
import com.squareup.picasso.Picasso

class CustomAdapter(private val context: Context, private val adpData: List<ListRes>)
    : RecyclerView.Adapter<CustomAdapter.MyViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
        val view = LayoutInflater.from(parent.context).inflate(R.layout.custom, parent, false)
        return MyViewHolder(view)
    }

    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
        val item = adpData[position]
        holder.id?.text = item.id.toString()
        holder.mail?.text = item.user
        holder.fname?.text = item.name
        holder.lname?.text = item.place
        holder.phonenumber?.text = item.phonenumber
        // If you want to load image:
        //Picasso.get().load(item.img).into(holder.iv)
        Picasso.with(context).load(adpData.get(holder.adapterPosition).img).into(holder.iv)

        holder.iv?.setOnClickListener {
            Toast.makeText(context,"Clicked ${item.name}",Toast.LENGTH_LONG).show()
        }
    }

    override fun getItemCount(): Int = adpData.size

    inner class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        var id: TextView? = itemView.findViewById(R.id.id1)
        var mail: TextView? = itemView.findViewById(R.id.email)
        var fname: TextView? = itemView.findViewById(R.id.firtsname)
        var lname: TextView? = itemView.findViewById(R.id.lastname)
        var phonenumber: TextView? = itemView.findViewById(R.id.phonenumber)
        var iv: ImageView? = itemView.findViewById(R.id.iv)
    }
}

 

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\ListRes.java

package com.example.apiintegration;
//import javax.annotation.Generated;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class ListRes {
    @SerializedName("id")
    @Expose
    private Integer id;
    @SerializedName("user")
    @Expose
    private String user;
    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("phonenumber")
    @Expose
    private String phonenumber;
    @SerializedName("place")
    @Expose
    private String place;
    @SerializedName("workinformation")
    @Expose
    private String workinformation;
    @SerializedName("img")
    @Expose
    private String img;
    @SerializedName("Remarks")
    @Expose
    private String remarks;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber) {
        this.phonenumber = phonenumber;
    }

    public String getPlace() {
        return place;
    }

    public void setPlace(String place) {
        this.place = place;
    }

    public String getWorkinformation() {
        return workinformation;
    }

    public void setWorkinformation(String workinformation) {
        this.workinformation = workinformation;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

}

 

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\Login.kt

package com.example.apiintegration
import android.content.Intent
import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import androidx.databinding.DataBindingUtil
import com.example.apiintegration.databinding.ActivityLoginBinding
import com.google.gson.JsonParser
import org.json.JSONObject
import retrofit2.Call
import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
class Login : AppCompatActivity() {
    var binding: ActivityLoginBinding?=null
    val TAG = "Login"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding=
            DataBindingUtil.setContentView(this,R.layout.activity_login)
        binding?.newuser?.setOnClickListener {
            var intent= Intent(this@Login,MenuPage::class.java)
            startActivity(intent)
        }
        binding?.login?.setOnClickListener {
            var uemail=binding?.email?.editText?.text.toString().trim()
            var upass=binding?.password?.editText?.text.toString().trim()

            //1
            var jsonObject= JSONObject()
            jsonObject.put("username",uemail)
            jsonObject.put("password",upass)

            //2
            var retrofit= Retrofit.Builder().
            baseUrl("https://7001.sites.marrichet.com/api/").
            addConverterFactory(GsonConverterFactory.create()).build()


            //3
            var retroInterface=retrofit.create(SampleProjectInterface::class.java)
            var requestjson=
                JsonParser().parse(jsonObject.toString()).asJsonObject
            var logsponsecall=retroInterface.loginUser(requestjson)

            logsponsecall?.enqueue(object :
                retrofit2.Callback<LoginResponse>{

                override fun onResponse(call: Call<LoginResponse>, response: Response<LoginResponse>) {
                    val loginResponse = response.body()
                    Log.d(TAG, "API Response: $loginResponse")

                    val token = loginResponse?.token
                    if (!token.isNullOrBlank()) {
                        Toast.makeText(this@Login, "Login successful!", Toast.LENGTH_SHORT).show()

                        val intent = Intent(this@Login, MenuPage::class.java)
                        startActivity(intent)

                        val sharedPreferences = getSharedPreferences("Login", MODE_PRIVATE)
                        val editor = sharedPreferences.edit()
                        editor.putString("email", uemail)
                        editor.putString("password", upass)
                        editor.putString("token", token)
                        editor.apply()
                    } else {
                        Toast.makeText(this@Login, "Login failed: Invalid token", Toast.LENGTH_LONG).show()
                    }
                }


                override fun onFailure(call: Call<LoginResponse>, t:
                Throwable) {

                    Log.d(TAG, "Request JSON onFailure: $call,$t")
                    Toast.makeText(this@Login,""+t,
                        Toast.LENGTH_LONG).show()
                }
            })
        }
    }
}

 

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\LoginResponse.kt

package com.example.apiintegration

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

class LoginResponse {
    @SerializedName("token")
    @Expose
    var token: String? = null

    @SerializedName("username")
    @Expose
    var username: String? = null

    @SerializedName("passwordadd")
    @Expose
    var passwordadd: String? = null

    @SerializedName("img")
    @Expose
    var img: String? = null
}


E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\MainActivity.kt

package com.example.apiintegration
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.databinding.DataBindingUtil
import com.example.apiintegration.databinding.ActivityMainBinding
import com.google.gson.JsonParser
import org.json.JSONObject
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.Response
import android.util.Log

class MainActivity : AppCompatActivity() {

    var binding: ActivityMainBinding?=null
    val TAG = "MainActivity"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding= DataBindingUtil.setContentView(this,R.layout.activity_main)



        binding?.register?.setOnClickListener{
            var name=binding?.username?.editText?.text.toString().trim()
//            var email=binding?.email?.editText?.text.toString().trim()
            var password=binding?.passwod?.editText?.text.toString().trim()

            //1
            var jsonObject= JSONObject()
            // jsonObject.put("key is from api","valuee from xml")
            jsonObject.put("username",name)
            jsonObject.put("password",password)
//            jsonObject.put("email",email)

            //2
            var retrofit= Retrofit.Builder().
            baseUrl("https://7001.sites.marrichet.com/api/")
                .addConverterFactory(GsonConverterFactory.create()).build()
            //3
            var retroInterface=retrofit.create(SampleProjectInterface::class.java)

            var regisetercall: Call<RegisterResponse>

            //6
            val `xyz` = JsonParser().parse(jsonObject.toString()).asJsonObject

            Log.d(TAG, "Request JSON: $xyz")

            //8
            val regResponseCall = retroInterface.createUser(`xyz`)

            regResponseCall?.enqueue(object : Callback<RegisterResponse?>{
                override fun onResponse(
                    call: Call<RegisterResponse?>,
                    response: Response<RegisterResponse?>

                ) {
                    Log.d(TAG, "Response received: $response,$call")
                    if (response.isSuccessful && response.body() != null) {
                        val registeredUsername = response.body()?.username
                        Toast.makeText(this@MainActivity, "Registered: $registeredUsername", Toast.LENGTH_LONG).show()
                        Log.d(TAG, "if black Response received: $response,$call")

                      // Navigate to Login activity or next step if needed

//                      startActivity(Intent(this@MainActivity, LoginActivity::class.java))
                    } else {
                        Toast.makeText(this@MainActivity, "Registration failed: ${response.errorBody()?.string()}", Toast.LENGTH_LONG).show()
                        Log.d(TAG, "else black Response received: $response,$call")

                        var intent= Intent(this@MainActivity, Login::class.java)
                        startActivity(intent)

                    }

                }

                override fun onFailure(call: Call<RegisterResponse?>, t: Throwable) {
                    Log.d(TAG, "OnFailure: $call,$t")
                    Toast.makeText(this@MainActivity,""+t.toString(),Toast.LENGTH_LONG).show()
                }
            })


    }

    }
}

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\MenuPage.kt

package com.example.apiintegration

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.LinearLayout
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.apiintegration.databinding.ActivityMainBinding
import com.example.apiintegration.databinding.ActivityMenuPageBinding
import com.google.gson.JsonParser
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

class MenuPage : AppCompatActivity() {

    var binding:ActivityMenuPageBinding?=null
    val TAG = "MenuPage"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()

//        setContentView(R.layout.activity_menu_page)
        binding=DataBindingUtil.setContentView(this,R.layout.activity_menu_page)


        var sharedPreferences=getSharedPreferences("Login", MODE_PRIVATE)
        var s1=sharedPreferences.getString("email",null)
        var s2=sharedPreferences.getString("pass",null)
        Toast.makeText(this@MenuPage, "" + s1 + s2, Toast.LENGTH_LONG).show()

        binding?.logout?.setOnClickListener{
            var editor=sharedPreferences.edit()
            editor.clear()
            editor.apply()


            // Redirect to Login (MainActivity)
            val intent = Intent(this@MenuPage, Login::class.java)
            startActivity(intent)
            finish()  // close MenuPage so user can't go back with back button
        }


        //2
        var retrofit= Retrofit.Builder().
        baseUrl("https://7001.sites.marrichet.com/api/")
            .addConverterFactory(GsonConverterFactory.create()).build()
        //3
        var retroInterface=retrofit.create(SampleProjectInterface::class.java)

        //6
        //var regisetercall: Call<RegisterResponse>

        //val datajson = JsonParser().parse(jsonObject.toString()).asJsonObject

        //Log.d(TAG, "Request JSON: $datajson")

        //8
        //val regResponseCall = retroInterface.createUser(datajson)
        val regResponseCall = retroInterface.loadData()


        regResponseCall?.enqueue(object : Callback<List<ListRes>?> {
            override fun onResponse(
                call: Call<List<ListRes>?>,
                response: Response<List<ListRes>?>
            ) {
                Log.d(TAG, "API Response: ${response.body()}")

                val linearLayoutManager = LinearLayoutManager(this@MenuPage,
                    LinearLayoutManager.VERTICAL, false)
                binding?.rec?.layoutManager = linearLayoutManager

                val customAdapter = CustomAdapter(this@MenuPage, response.body() ?: emptyList())
                binding?.rec?.adapter = customAdapter
            }

            override fun onFailure(call: Call<List<ListRes>?>, t: Throwable) {
                Log.d(TAG, "OnFailure: $call,$t")
                Toast.makeText(this@MenuPage,""+t.toString(),Toast.LENGTH_LONG).show()
            }
        })

    }



}

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\RegisterResponse.kt

package com.example.apiintegration


//✅ 1. Ensure You're Using the Right Shortcut
//For Windows/Linux:
//Ctrl + Alt + Shift + K

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

//https://www.jsonschema2pojo.org/
class RegisterResponse {
    @SerializedName("username")
    @Expose
    var username: String? = null
}

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\SampleProjectInterface.kt

package com.example.apiintegration

import com.google.gson.JsonObject
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.POST

public interface SampleProjectInterface {


    @Headers("Content-Type: application/json")
    @POST("register/")
    fun createUser(@Body jsonObject: JsonObject): Call<RegisterResponse>?

    @Headers("Content-Type:application/json")
    @POST("login/")
    fun loginUser(@Body jsonObject: JsonObject): Call<LoginResponse>

//    https://7001.sites.marrichet.com/api/contactbookapi/

    @Headers("Content-Type:application/json")
    @GET("contactbookapi/")
    fun loadData(): Call<List<ListRes>>



}

E:\android\android apps\APIIntegration\app\src\main\java\com\example\apiintegration\Support.kt

package com.example.apiintegration
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
class Support {
    @SerializedName("url")
    @Expose
    var url: String? = null
    @SerializedName("text")
    @Expose
    var text: String? = null
}

 

E:\android\android apps\APIIntegration\app\src\main\res\layout\activity_dash_board.xml

<?xml version="1.0" encoding="utf-8"?>
<layout>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".DashBoard"
        android:orientation="vertical">
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/logout"
            android:layout_margin="10dp"
            android:text="Logout"/>
        <androidx.recyclerview.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:id="@+id/rec"/>
    </LinearLayout>
</layout>

E:\android\android apps\APIIntegration\app\src\main\res\layout\activity_login.xml

<?xml version="1.0" encoding="utf-8"?>
<layout>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".Login">
        <androidx.cardview.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_margin="5dp">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Login Here"
                    android:layout_gravity="center" />
                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/email"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="email"
                    android:layout_margin="5dp"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
                    <com.google.android.material.textfield.TextInputEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        />
                </com.google.android.material.textfield.TextInputLayout>
                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Password"
                    android:layout_margin="5dp"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
                    <com.google.android.material.textfield.TextInputEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        />
                </com.google.android.material.textfield.TextInputLayout>
                <Button
                    android:id="@+id/login"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Login"
                    android:padding="5dp"
                    android:layout_margin="5dp"
                    android:layout_gravity="center"
                    />
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/newuser"
                    android:text="New User Register Here"
                    android:textSize="25sp"/>
            </LinearLayout>
        </androidx.cardview.widget.CardView>
    </RelativeLayout>
</layout>

E:\android\android apps\APIIntegration\app\src\main\res\layout\activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<layout>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity"
        android:id="@+id/main"
        android:orientation="vertical">

        <androidx.cardview.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:orientation="vertical">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Register here"
                    />

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/username"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="UserName"
                    android:layout_margin="5dp">

                    <com.google.android.material.textfield.TextInputEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        />

                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/passwod"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Password"
                    android:layout_margin="5dp">

                    <com.google.android.material.textfield.TextInputEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        />

                </com.google.android.material.textfield.TextInputLayout>

                <Button
                    android:id="@+id/register"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Register"
                    android:layout_gravity="center"
                    />
            </LinearLayout>
        </androidx.cardview.widget.CardView>

    </RelativeLayout>
</layout>

E:\android\android apps\APIIntegration\app\src\main\res\layout\activity_menu_page.xml

<?xml version="1.0" encoding="utf-8"?>
<layout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MenuPage"
    android:orientation="vertical"
    >
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="logout"
        android:id="@+id/logout"
        />

    <androidx.recyclerview.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/rec"/>

</LinearLayout>
</layout>

E:\android\android apps\APIIntegration\app\src\main\res\layout\custom.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="8dp">

    <!-- Avatar Image -->
    <ImageView
        android:id="@+id/iv"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:scaleType="centerCrop"
        android:src="@mipmap/ic_launcher"
        android:layout_marginEnd="8dp" />

    <!-- Text Container -->
    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:id="@+id/id1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="ID"
            android:textStyle="bold"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/email"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="User Email"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/firtsname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Name"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/lastname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Place"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/phonenumber"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="phonenumber"
            android:textSize="14sp" />


    </LinearLayout>

</LinearLayout>

 

E:\android\android apps\APIIntegration\app\build.gradle.kts

android {
    compileSdk = 35
    defaultConfig {
        targetSdk = 35
    }

    buildFeatures {
        dataBinding = true
    }
}


dependencies {
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.appcompat)
    implementation(libs.material)
    implementation(libs.androidx.activity)
    implementation(libs.androidx.constraintlayout)

    implementation("com.squareup.retrofit2:retrofit:2.11.0")
    implementation("com.squareup.retrofit2:converter-gson:2.11.0")
    implementation ("com.google.code.gson:gson:2.8.9")
    implementation ("com.github.bumptech.glide:glide:4.16.0")
    implementation ("com.squareup.picasso:picasso:2.5.2")

    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
}

 

Output: