

{"id":118635,"date":"2023-09-11T19:00:28","date_gmt":"2023-09-11T13:30:28","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=118635"},"modified":"2026-06-01T14:14:44","modified_gmt":"2026-06-01T08:44:44","slug":"android-kotlin-grocery-shopping-app","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/","title":{"rendered":"Android Kotlin Project \u2013 Grocery Shopping App"},"content":{"rendered":"<p>Hey there, Android enthusiasts! Today we are going to see and learn how to implement an Android Project called grocery shopping in Android Studio. We\u2019ll understand the complete project&#8217;s development in this article.<\/p>\n<p>Users typically forget to buy the goods they wish to buy because we can&#8217;t remember everything. But you may use this app to create a list of the items you want to buy so that you don&#8217;t forget anything. The Grocery Shopping application will help the user by maintaining a list of items along with price and quantity, which will make grocery shopping easier and hassle-free.<\/p>\n<h3>About Android Kotlin Grocery Shopping App<\/h3>\n<p>For those who are still learning the fundamentals of creating Android applications, here is an Android project. Users of this Android app can add things to their shopping lists by clicking the floating button in the bottom right corner of the main screen.<\/p>\n<p>The home screen will display all the items entered by the user.<\/p>\n<p>We will use Android Studio and the programming language Kotlin to develop this Android application.<\/p>\n<p><strong> Let&#8217;s look over the list of features that the user interface will include:<\/strong><\/p>\n<p>1. A floating &#8220;+&#8221; button will be included in the user interface at the bottom right corner of the home screen.<br \/>\n2. The &#8216;+&#8217; button will display a bottom screen fragment with three text fields when clicked.<br \/>\n3. The user must input the item&#8217;s name and quantity in the two text areas.<br \/>\n4. The user must enter the item&#8217;s price in the third field.<br \/>\n5. The newly entered task details will be saved onto the ROOM database and made visible on the home screen by clicking the &#8220;Save&#8221; button at the bottom of the sheet fragment.<br \/>\n6. On the home screen, a checkbox that can be used to mark a task as completed is displayed alongside a list of all the tasks that the user has entered.<br \/>\n7. There will be a &#8220;trash&#8221; icon next to each item on the home screen, and clicking it will remove it from both the home screen and the database.<\/p>\n<h3>Prerequisites For Grocery Shopping App using Android Kotlin<\/h3>\n<p><strong>To develop this Android application, the requirements and prerequisites are as follows:<\/strong><\/p>\n<p><strong>1. Kotlin:<\/strong> You must first become acquainted with Kotlin programming. It is necessary since we will create the app&#8217;s code in the Kotlin programming language.<br \/>\n<strong>2. XML:<\/strong> XML is yet another essential element of our Android application. It will be used to create the user interface for the application.<br \/>\n<strong>3. Android Studio:<\/strong> Android Studio: Because that is how we will develop it, Android Studio is the foundation of our programme. An Android virtual device that can be used to test an application&#8217;s functionality is also available with Android Studio.<br \/>\n<strong>4. ROOM DAOs:<\/strong> The queries needed to insert\/write data into the database are referred to as ROOM DAOs. Knowledge of fundamental database management is crucial.<\/p>\n<h3>Download Android Kotlin Grocery Shopping App Project<\/h3>\n<p>Please download the source code of the Android Kotlin Grocery Shopping App Project: <a href=\"https:\/\/drive.google.com\/file\/d\/1aOTLNdcd5dDZ3U2WeO43M48pnKSTSDwX\/view?usp=drive_link\"><strong>Android<\/strong> <strong>Kotlin<\/strong> <strong>Grocery Shopping App Project Code.<\/strong><\/a><\/p>\n<h3>Develop a Grocery Shopping app in Android Studio.<\/h3>\n<p>Let&#8217;s start by making a grocery-buying application in Android Studio. Step-by-step instructions have been provided for each and every file in this tutorial to help you better grasp how the program functions.<\/p>\n<p><strong>To develop this grocery shopping app for Android, you must follow a few steps.<\/strong><\/p>\n<p>1. At the location of your choice, extract all the files from the downloaded zip file.<br \/>\n2. Launch Android Studio.<br \/>\n3. Select File, then select Open.<br \/>\n4. Click OK when you locate and pick the extracted folder.<\/p>\n<p>You have successfully opened the grocery shopping app\u2019s source code in Android Studio.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/android-studio.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-118639 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/android-studio.webp\" alt=\"android studio\" width=\"1917\" height=\"1020\" \/><\/a><\/p>\n<p>Let&#8217;s go through each file in this project one at a time as we comprehend how the application works.<\/p>\n<p>1. The text fields and buttons found in the user interface are created by an XML file called &#8220;activity_main&#8221;.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;RelativeLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n   xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n   android:layout_width=\"match_parent\"\r\n   android:background=\"#F9F9F9\"\r\n   android:layout_height=\"match_parent\"\r\n   tools:context=\".MainActivity\"&gt;\r\n\r\n\r\n\r\n\r\n   &lt;androidx.recyclerview.widget.RecyclerView\r\n       android:id=\"@+id\/rvitems\"\r\n       android:layout_width=\"match_parent\"\r\n       android:layout_height=\"match_parent\"\r\n       tools:listitem=\"@layout\/grocery_rv_item\"&gt;\r\n\r\n\r\n   &lt;\/androidx.recyclerview.widget.RecyclerView&gt;\r\n\r\n\r\n\r\n\r\n   &lt;com.google.android.material.floatingactionbutton.FloatingActionButton\r\n       android:id=\"@+id\/fabAdd\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_alignParentEnd=\"true\"\r\n       android:layout_alignParentBottom=\"true\"\r\n       android:layout_marginStart=\"25dp\"\r\n       android:layout_marginTop=\"25dp\"\r\n       android:layout_marginEnd=\"25dp\"\r\n       android:layout_marginBottom=\"25dp\"\r\n       android:backgroundTint=\"@color\/purple_700\"\r\n       android:elevation=\"5dp\"\r\n       android:src=\"@drawable\/ic_baseline_add\"\r\n       app:tint=\"@color\/white\" \/&gt;\r\n\r\n\r\n\r\n\r\n&lt;\/RelativeLayout&gt;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/activity-main-xml.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-118640 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/activity-main-xml.webp\" alt=\"activity main xml\" width=\"1920\" height=\"1023\" \/><\/a><\/p>\n<p>2. \u2018grocery_add_dialog.xml\u2019 is a file responsible for creating a user interface where the user will enter the required details about the newly added item.<\/p>\n<p>The below XML code defines a CardView that contains a form for adding a new item to a list. The form consists of three text input fields for entering the item name, quantity, and price. There are also two buttons, Cancel and Add, for cancelling or adding the item to the list.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;androidx.cardview.widget.CardView xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   android:layout_width=\"match_parent\"\r\n   android:layout_height=\"wrap_content\"\r\n   xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n   android:layout_gravity=\"center\"\r\n   android:backgroundTint=\"#FEFBF6\"\r\n   android:background=\"@drawable\/btn_bg\"\r\n   app:cardCornerRadius=\"10dp\"&gt;\r\n   &lt;RelativeLayout\r\n       android:layout_width=\"match_parent\"\r\n       android:layout_height=\"wrap_content\"\r\n       &gt;\r\n\r\n\r\n       &lt;TextView\r\n           android:id=\"@+id\/idtvHeading\"\r\n           android:layout_width=\"match_parent\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:layout_marginStart=\"4dp\"\r\n           android:layout_marginTop=\"4dp\"\r\n           android:layout_marginEnd=\"4dp\"\r\n           android:layout_marginBottom=\"4dp\"\r\n           android:background=\"@color\/blue\"\r\n           android:gravity=\"center\"\r\n           android:padding=\"4dp\"\r\n           android:text=\"Add Item To List\"\r\n           android:textAlignment=\"center\"\r\n           android:textAllCaps=\"false\"\r\n           android:textColor=\"@color\/white\"\r\n           android:textSize=\"20sp\"\r\n           android:textStyle=\"bold\" \/&gt;\r\n\r\n\r\n       &lt;ImageView\r\n           android:id=\"@+id\/imageView\"\r\n           android:layout_width=\"65dp\"\r\n           android:layout_height=\"45dp\"\r\n           android:src=\"@drawable\/ic_baseline_local_grocery_store_24\"\r\n           app:layout_constraintBottom_toBottomOf=\"parent\"\r\n           app:layout_constraintEnd_toEndOf=\"parent\"\r\n           app:layout_constraintHorizontal_bias=\"0.797\"\r\n           app:layout_constraintStart_toStartOf=\"parent\"\r\n           app:layout_constraintVertical_bias=\"0.0\" \/&gt;\r\n\r\n\r\n       &lt;LinearLayout\r\n           android:layout_width=\"match_parent\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:layout_below=\"@id\/idtvHeading\"\r\n           android:orientation=\"vertical\"&gt;\r\n           &lt;com.google.android.material.textfield.TextInputLayout\r\n               android:layout_width=\"match_parent\"\r\n               android:layout_height=\"wrap_content\"\r\n               android:layout_margin=\"10dp\"\r\n               android:padding=\"5dp\"\r\n\r\n\r\n               app:hintTextColor=\"@color\/black\"\r\n               app:counterTextColor=\"@color\/black\"&gt;\r\n               &lt;com.google.android.material.textfield.TextInputEditText\r\n                   android:layout_width=\"match_parent\"\r\n                   android:layout_height=\"wrap_content\"\r\n                   android:id=\"@+id\/idEdtitemname\"\r\n                   android:textSize=\"14sp\"\r\n                   android:hint=\"Enter item Name\"\r\n                   android:inputType=\"text\"\r\n                   app:hintTextColor=\"@color\/black\"\r\n                   app:counterTextColor=\"@color\/black\"\r\n                   \/&gt;\r\n           &lt;\/com.google.android.material.textfield.TextInputLayout&gt;\r\n           &lt;com.google.android.material.textfield.TextInputLayout\r\n               android:layout_width=\"match_parent\"\r\n               android:layout_height=\"wrap_content\"\r\n               android:layout_margin=\"10dp\"\r\n               android:padding=\"5dp\"\r\n\r\n\r\n               app:hintTextColor=\"@color\/black\"\r\n               app:counterTextColor=\"@color\/black\"&gt;\r\n               &lt;com.google.android.material.textfield.TextInputEditText\r\n                   android:layout_width=\"match_parent\"\r\n                   android:layout_height=\"wrap_content\"\r\n                   android:id=\"@+id\/idEdtitemquantity\"\r\n                   android:textSize=\"14sp\"\r\n                   android:hint=\"Enter item Quantity in kg\"\r\n                   android:inputType=\"numberDecimal\"\r\n                   app:hintTextColor=\"@color\/black\"\r\n                   app:counterTextColor=\"@color\/black\"\r\n                   \/&gt;\r\n           &lt;\/com.google.android.material.textfield.TextInputLayout&gt;\r\n           &lt;com.google.android.material.textfield.TextInputLayout\r\n               android:layout_width=\"match_parent\"\r\n               android:layout_height=\"wrap_content\"\r\n               android:layout_margin=\"10dp\"\r\n               android:padding=\"5dp\"\r\n\r\n\r\n               app:hintTextColor=\"@color\/black\"\r\n               app:counterTextColor=\"@color\/black\"&gt;\r\n               &lt;com.google.android.material.textfield.TextInputEditText\r\n                   android:layout_width=\"match_parent\"\r\n                   android:layout_height=\"wrap_content\"\r\n                   android:id=\"@+id\/idEdtitemprice\"\r\n                   android:textSize=\"14sp\"\r\n                   android:hint=\"Enter item Price \/kg\"\r\n                   android:inputType=\"numberDecimal\"\r\n                   app:hintTextColor=\"@color\/black\"\r\n                   app:counterTextColor=\"@color\/black\"\r\n                   \/&gt;\r\n           &lt;\/com.google.android.material.textfield.TextInputLayout&gt;\r\n           &lt;LinearLayout\r\n               android:layout_width=\"match_parent\"\r\n               android:layout_height=\"wrap_content\"\r\n               android:orientation=\"horizontal\"\r\n               android:layout_margin=\"5dp\"\r\n               android:weightSum=\"2\"&gt;\r\n               &lt;androidx.appcompat.widget.AppCompatButton\r\n                   android:layout_width=\"0dp\"\r\n                   android:layout_height=\"wrap_content\"\r\n                   android:layout_weight=\"1\"\r\n                   android:layout_margin=\"8dp\"\r\n                   android:padding=\"5dp\"\r\n                   android:id=\"@+id\/idbtncancel\"\r\n                   android:text=\"Cancel\"\r\n                   android:textColor=\"@color\/white\"\r\n                   android:background=\"@drawable\/btn_bg\"\r\n                   android:textAllCaps=\"false\"\r\n                   \/&gt;\r\n               &lt;androidx.appcompat.widget.AppCompatButton\r\n                   android:layout_width=\"0dp\"\r\n                   android:layout_height=\"wrap_content\"\r\n                   android:layout_weight=\"1\"\r\n                   android:layout_margin=\"8dp\"\r\n                   android:padding=\"5dp\"\r\n                   android:id=\"@+id\/idbtnadd\"\r\n                   android:text=\"Add\"\r\n                   android:textColor=\"@color\/white\"\r\n                   android:background=\"@drawable\/btn_bg\"\r\n                   android:textAllCaps=\"false\"\r\n                   \/&gt;\r\n           &lt;\/LinearLayout&gt;\r\n       &lt;\/LinearLayout&gt;\r\n\r\n\r\n   &lt;\/RelativeLayout&gt;\r\n\r\n\r\n&lt;\/androidx.cardview.widget.CardView&gt;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocery-add-dialog-xml.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-118641 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocery-add-dialog-xml.webp\" alt=\"grocery add dialog xml\" width=\"1920\" height=\"1078\" \/><\/a><\/p>\n<p>3. \u2018grocery_rv_item.xmll\u2019 is an XML file that is responsible for creating the user interface (UI) for items that are presented on the home screen.<\/p>\n<p>The XML code mentioned above creates a CardView that has a layout for showing a grocery list item. The item name, quantity, rate, and total cost are displayed using four different text views in the layout. For deleting the item, there is also an image view available.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;androidx.cardview.widget.CardView xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   android:layout_width=\"match_parent\"\r\n   android:layout_height=\"wrap_content\"\r\n   xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n   android:layout_margin=\"5dp\"\r\n   android:backgroundTint=\"@color\/white\"\r\n   app:cardCornerRadius=\"3dp\"\r\n   app:cardElevation=\"5dp\"&gt;\r\n   &lt;RelativeLayout\r\n       android:layout_width=\"match_parent\"\r\n       android:layout_height=\"wrap_content\"&gt;\r\n       &lt;LinearLayout\r\n           android:layout_width=\"match_parent\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:orientation=\"horizontal\"\r\n           android:weightSum=\"5\"\r\n           android:id=\"@+id\/idLL1\"&gt;\r\n           &lt;TextView\r\n               android:layout_width=\"0dp\"\r\n               android:layout_height=\"wrap_content\"\r\n               android:layout_weight=\"2\"\r\n               android:text=\"Item Name\"\r\n               android:textColor=\"@color\/black\"\r\n               android:padding=\"4dp\"\r\n               android:layout_margin=\"3dp\"\r\n               android:id=\"@+id\/idtvitemname\"\/&gt;\r\n           &lt;TextView\r\n               android:layout_width=\"0dp\"\r\n               android:layout_height=\"wrap_content\"\r\n               android:layout_weight=\"1.25\"\r\n               android:text=\"Quantity\"\r\n               android:textColor=\"@color\/black\"\r\n               android:padding=\"4dp\"\r\n               android:layout_margin=\"3dp\"\r\n               android:id=\"@+id\/idtvquantity\"\/&gt;\r\n           &lt;TextView\r\n               android:layout_width=\"0dp\"\r\n               android:layout_height=\"wrap_content\"\r\n               android:layout_weight=\"1.25\"\r\n               android:text=\"Rate\"\r\n               android:textColor=\"@color\/black\"\r\n               android:padding=\"4dp\"\r\n               android:layout_margin=\"3dp\"\r\n               android:id=\"@+id\/idtvrate\"\/&gt;\r\n           &lt;ImageView\r\n               android:layout_width=\"0dp\"\r\n               android:layout_height=\"wrap_content\"\r\n               android:layout_weight=\"0.5\"\r\n               android:id=\"@+id\/idivdelete\"\r\n               android:padding=\"4dp\"\r\n               android:src=\"@drawable\/ic_baseline_delete_24\"\r\n               app:tint=\"@color\/blue_light\"\r\n               android:layout_margin=\"3dp\"\/&gt;\r\n       &lt;\/LinearLayout&gt;\r\n       &lt;TextView\r\n           android:layout_width=\"match_parent\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:padding=\"4dp\"\r\n           android:layout_margin=\"3dp\"\r\n           android:id=\"@+id\/idtvheading\"\r\n           android:layout_toLeftOf=\"@id\/idtvtotalamount\"\r\n           android:layout_below=\"@id\/idLL1\"\r\n           android:text=\"Total Cost :\"\r\n           android:textColor=\"@color\/black\"\/&gt;\r\n       &lt;TextView\r\n           android:layout_width=\"wrap_content\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:padding=\"4dp\"\r\n           android:layout_margin=\"3dp\"\r\n           android:id=\"@+id\/idtvtotalamount\"\r\n           android:layout_below=\"@id\/idLL1\"\r\n           android:text=\"Amount\"\r\n           android:layout_alignParentEnd=\"true\"\r\n           android:textColor=\"@color\/black\"\/&gt;\r\n\r\n\r\n   &lt;\/RelativeLayout&gt;\r\n\r\n\r\n&lt;\/androidx.cardview.widget.CardView&gt;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocerydao-kt.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-118642 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocerydao-kt.webp\" alt=\"grocerydao kt\" width=\"1920\" height=\"1080\" \/><\/a><\/p>\n<p>Let\u2019s start with setting up the necessary files required for creating a ROOM database that will store the task\u2019s name and description.<\/p>\n<p>1. When the ROOM database is initialized, an entity file called &#8220;GroceryDatabase.kt&#8221; will be created. The database&#8217;s appropriate tables and columns will be constructed with the aid of this file.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">@Database(entities = [GroceryItems::class], version = 1)\r\n\r\n\r\nabstract class GroceryDatabase : RoomDatabase() {\r\n\r\n\r\n   abstract fun getGroceryDao() : GroceryDao\r\n   companion object {\r\n       @Volatile\r\n       private var instance: GroceryDatabase? = null\r\n       private val LOCK = Any()\r\n\r\n\r\n       operator fun invoke(context: Context) = instance ?: synchronized(LOCK) {\r\n           instance ?: createDatabase(context).also {\r\n               instance = it\r\n           }\r\n\r\n\r\n       }\r\n\r\n\r\n\r\n\r\n       private fun createDatabase(context: Context) =\r\n           Room.databaseBuilder(\r\n               context.applicationContext,\r\n               GroceryDatabase::class.java,\r\n               \"GroceryApp.db\"\r\n           ).build()\r\n   }\r\n}<\/pre>\n<p>2. The methods that can access the database are defined by the interface &#8220;GroceryDAO.kt,&#8221; which is a data access object. We have defined the &#8216;insert&#8217; and &#8216;delete&#8217; queries in this file using annotations. The &#8216;insert&#8217; query will insert data into the designated database table, and the &#8216;delete&#8217; query will allow the user to remove a previously saved item from the database.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import androidx.lifecycle.LiveData\r\nimport androidx.room.*\r\n\r\n\r\n@Dao\r\n\r\n\r\ninterface GroceryDao {\r\n   @Insert(onConflict = OnConflictStrategy.REPLACE)\r\n   suspend fun insert(item: GroceryItems)\r\n   @Delete\r\n   suspend fun delete(item: GroceryItems)\r\n   @Query(\"SELECT * FROM Grocery_items\")\r\n   fun getAllGroceryItems(): LiveData&lt;List&lt;GroceryItems&gt;&gt;\r\n}\r\n<\/pre>\n<p>3. \u2018GroceryItems.kt\u2019 is a Kotlin file where the table name as well as the attributes that will be stored in the database are mentioned.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import androidx.room.ColumnInfo\r\nimport androidx.room.Entity\r\nimport androidx.room.PrimaryKey\r\n\r\n\r\n@Entity(tableName = \"Grocery_items\")\r\ndata class GroceryItems (\r\n   @ColumnInfo(name = \"itemName\")\r\n   var itemName:String,\r\n\r\n\r\n   @ColumnInfo(name = \"itemQuantity\")\r\n   var itemQuantity:Double,\r\n\r\n\r\n   @ColumnInfo(name = \"itemPrice\")\r\n   var itemPrice:Double,\r\n)\r\n{\r\n   @PrimaryKey(autoGenerate = true)\r\n   var id:Int?=null\r\n}<\/pre>\n<h4>Moving on to the files that are responsible for the working and functioning of the application.<\/h4>\n<p>1. The RecyclerView adapter for showing a list of supermarket products is defined in the GroceryRVAdapter.kt\u2019 Kotlin file. The adapter implements the GroceryItemClickInterface interface and derives from the RecyclerView.Adapter class.<\/p>\n<ul>\n<li>The GroceryViewHolder and GroceryItemClickInterface inner classes make up the adapter.<\/li>\n<li>The ViewHolder that will be used to hold the views for each item in the RecyclerView is defined by the GroceryViewHolder class.<\/li>\n<li>When an item in the RecyclerView is clicked, the GroceryItemClickInterface interface provides the methods that will be invoked.<\/li>\n<\/ul>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class GroceryRVAdapter(\r\n   var list: List&lt;GroceryItems&gt;,\r\n   val groceryItemClickInterface: GroceryItemClickInterface\r\n)\r\n   : RecyclerView.Adapter&lt;GroceryRVAdapter.GroceryViewHolder&gt;() {\r\n\r\n\r\n   inner class GroceryViewHolder(itemView:View):RecyclerView.ViewHolder(itemView){\r\n       val nameTV = itemView.findViewById&lt;TextView&gt;(R.id.idtvitemname)\r\n       val quantityTV = itemView.findViewById&lt;TextView&gt;(R.id.idtvquantity)\r\n       val rateTV = itemView.findViewById&lt;TextView&gt;(R.id.idtvrate)\r\n       val totalTV = itemView.findViewById&lt;TextView&gt;(R.id.idtvtotalamount)\r\n       val deleteIV = itemView.findViewById&lt;ImageView&gt;(R.id.idivdelete)\r\n   }\r\n\r\n\r\n\r\n\r\n   interface GroceryItemClickInterface{\r\n       fun onItemClick(groceryItems: GroceryItems)\r\n   }\r\n\r\n\r\n   override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GroceryViewHolder {\r\n       val view = LayoutInflater.from(parent.context).inflate(R.layout.grocery_rv_item,parent,false)\r\n       return GroceryViewHolder(view)\r\n   }\r\n\r\n\r\n   override fun onBindViewHolder(holder: GroceryViewHolder, position: Int) {\r\n       holder.nameTV.text = list.get(position).itemName\r\n       holder.quantityTV.text = list.get(position).itemQuantity.toString()\r\n       holder.rateTV.text = \"\u20b9: \" + list.get(position).itemPrice.toString()\r\n       val itemTotal: Double = list.get(position).itemQuantity * list.get(position).itemPrice\r\n       holder.totalTV.text = \"\u20b9: \" + itemTotal.toString()\r\n       holder.deleteIV.setOnClickListener {\r\n           groceryItemClickInterface.onItemClick(list.get(position))\r\n\r\n\r\n       }\r\n   }\r\n   override fun getItemCount(): Int {\r\n       return list.size\r\n   }\r\n}<\/pre>\n<p>2. The \u201cGroceryViewMode.kt\u2019 defines a ViewModel class for the grocery shopping app. The ViewModel class inherits from the ViewModel class and has three methods: insert(), delete(), and getAllGroceryItems().<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import androidx.lifecycle.ViewModel\r\nimport kotlinx.coroutines.GlobalScope\r\nimport kotlinx.coroutines.launch\r\n\r\n\r\nclass GroceryViewModel(private val repository: GroceryRepository):ViewModel() {\r\n   fun insert(items: GroceryItems) = GlobalScope.launch {\r\n       repository.insert(items)\r\n   }\r\n   fun delete(items: GroceryItems) = GlobalScope.launch {\r\n       repository.delete(items)\r\n   }\r\n   fun getAllGroceryItems() = repository.getAllItems()\r\n}<\/pre>\n<p>3. The above Kotlin code defines a ViewModelFactory class for the grocery shopping app. The ViewModelFactory class inherits from the ViewModelProvider.NewInstanceFactory class and has one method: create().<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import androidx.lifecycle.ViewModel\r\nimport androidx.lifecycle.ViewModelProvider\r\n\r\n\r\nclass GroceryViewModelFactory(private val repository: GroceryRepository):ViewModelProvider.NewInstanceFactory() {\r\n   override fun &lt;T : ViewModel&gt; create(modelClass: Class&lt;T&gt;): T {\r\n       return GroceryViewModel(repository) as T\r\n   }\r\n}<\/pre>\n<p>4. The below Kotlin code defines the MainActivity class for the grocery shopping app. The MainActivity class inherits from the AppCompatActivity class and implements the GroceryRVAdapter.GroceryItemClickInterface interface.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class MainActivity : AppCompatActivity(), GroceryRVAdapter.GroceryItemClickInterface {\r\n   lateinit var itemRV: RecyclerView\r\n   lateinit var addFAB: FloatingActionButton\r\n   lateinit var list: List&lt;GroceryItems&gt;\r\n   lateinit var groceryRVAdapter: GroceryRVAdapter\r\n   lateinit var groceryViewModel: GroceryViewModel\r\n   override fun onCreate(savedInstanceState: Bundle?) {\r\n       super.onCreate(savedInstanceState)\r\n       setContentView(R.layout.activity_main)\r\n       itemRV = findViewById(R.id.rvitems)\r\n       addFAB = findViewById(R.id.fabAdd)\r\n       list = ArrayList&lt;GroceryItems&gt;()\r\n       groceryRVAdapter = GroceryRVAdapter(list,this)\r\n       itemRV.layoutManager = LinearLayoutManager(this)\r\n       itemRV.adapter = groceryRVAdapter\r\n       val groceryRepository = GroceryRepository(GroceryDatabase(this))\r\n       val factory = GroceryViewModelFactory(groceryRepository)\r\n       groceryViewModel = ViewModelProvider(this,factory).get(GroceryViewModel::class.java)\r\n       groceryViewModel.getAllGroceryItems().observe(this, Observer {\r\n           groceryRVAdapter.list = it\r\n           groceryRVAdapter.notifyDataSetChanged()\r\n       })\r\n       addFAB.setOnClickListener{\r\n           openDialog()\r\n       }\r\n\r\n\r\n\r\n\r\n   }\r\n   fun openDialog(){\r\n       val dialog = Dialog(this)\r\n       dialog.setContentView(R.layout.grocery_add_dialog)\r\n       val cancelbtn = dialog.findViewById&lt;AppCompatButton&gt;(R.id.idbtncancel)\r\n       val addbtn = dialog.findViewById&lt;AppCompatButton&gt;(R.id.idbtnadd)\r\n       val itemEdt = dialog.findViewById&lt;EditText&gt;(R.id.idEdtitemname)\r\n       val itemPriceEdt = dialog.findViewById&lt;EditText&gt;(R.id.idEdtitemprice)\r\n       val itemQuantityEdt = dialog.findViewById&lt;EditText&gt;(R.id.idEdtitemquantity)\r\n       cancelbtn.setOnClickListener {\r\n           dialog.dismiss()\r\n       }\r\n       addbtn.setOnClickListener {\r\n           val itemname:String = itemEdt.text.toString()\r\n           val itemprice:String = itemPriceEdt.text.toString()\r\n           val itemquantity:String = itemQuantityEdt.text.toString()\r\n           val qty : Double = itemquantity.toDouble()\r\n           val pr : Double = itemprice.toDouble()\r\n           if (itemname.isNotEmpty() &amp;&amp; itemprice.isNotEmpty() &amp;&amp; itemquantity.isNotEmpty()){\r\n               val items = GroceryItems(itemname,qty,pr)\r\n               groceryViewModel.insert(items)\r\n               Toast.makeText(applicationContext,\"Item Added\", Toast.LENGTH_SHORT).show()\r\n               groceryRVAdapter.notifyDataSetChanged()\r\n               dialog.dismiss()\r\n           }\r\n           else{\r\n               Toast.makeText(applicationContext,\"Please fill all details properly\", Toast.LENGTH_SHORT).show()\r\n           }\r\n\r\n\r\n       }\r\n       dialog.show()\r\n   }\r\n\r\n\r\n   override fun onItemClick(groceryItems: GroceryItems) {\r\n       groceryViewModel.delete(groceryItems)\r\n       groceryRVAdapter.notifyDataSetChanged()\r\n       Toast.makeText(applicationContext,\"Item Deleted Successfully.\", Toast.LENGTH_SHORT).show()\r\n   }\r\n}<\/pre>\n<h3>Android Kotlin Grocery Shopping App Output:<\/h3>\n<h4>1. Home Screen:<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocery-shopping-home-screen-1.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-118644 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocery-shopping-home-screen-1.webp\" alt=\"grocery shopping home screen\" width=\"400\" height=\"836\" \/><\/a><\/p>\n<h4>2. New Item sheet fragment is created when the \u2018add\u2019 button is pressed.<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocery-shopping-app-adding-new-item.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-118645 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocery-shopping-app-adding-new-item.webp\" alt=\"grocery shopping app adding new item\" width=\"400\" height=\"839\" \/><\/a><\/p>\n<h4>3. Home screen displays all the items stored in the database.<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/list-of-added-items.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-118646 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/list-of-added-items.webp\" alt=\"list of added items\" width=\"400\" height=\"836\" \/><\/a><\/p>\n<h4>4. Deleting an item from the database.<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocery-shopping-app-item-deleted.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-118647 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/grocery-shopping-app-item-deleted.webp\" alt=\"grocery shopping app item deleted\" width=\"400\" height=\"839\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>Thus, in this Project, we learned how to use Android Studio to design and develop a android kotlin grocery shopping app. Beginners would greatly benefit from working on this project because it will familiarize them with using XML to design user interfaces, switching between tasks by clicking a button, using the ROOM database, particularly when putting data into the database, and understanding how the recycler view functions. We truly hope you found it enjoyable, and we have no doubt that you will love putting it into practice.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2603,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1aOTLNdcd5dDZ3U2WeO43M48pnKSTSDwX\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601084521\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1aOTLNdcd5dDZ3U2WeO43M48pnKSTSDwX\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-02 07:26:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-18 02:42:21&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-22 16:16:45&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-26 10:52:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-02 10:23:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-06 07:20:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-11 08:45:30&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-15 05:58:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-18 11:39:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-23 00:04:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-30 00:30:21&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-07-30 00:30:21&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey there, Android enthusiasts! Today we are going to see and learn how to implement an Android Project called grocery shopping in Android Studio. We\u2019ll understand the complete project&#8217;s development in this article. Users&#46;&#46;&#46;<\/p>\n","protected":false},"author":581,"featured_media":118638,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27612],"tags":[28090,28089,28093,27685,28092,28091],"class_list":["post-118635","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android-kotlin-tutorials","tag-android-kotlin-grocery-shopping-app","tag-android-kotlin-grocery-shopping-app-project","tag-android-kotlin-project","tag-android-kotlin-project-ideas","tag-grocery-shopping-app","tag-grocery-shopping-app-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Kotlin Project \u2013 Grocery Shopping App - DataFlair<\/title>\n<meta name=\"description\" content=\"Android Kotlin Grocery Shopping App will help the user by maintaining a list of items along with price and quantity.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Kotlin Project \u2013 Grocery Shopping App - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Android Kotlin Grocery Shopping App will help the user by maintaining a list of items along with price and quantity.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-11T13:30:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T08:44:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/android-kotlin-grocery-shopping-app.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Kotlin Project \u2013 Grocery Shopping App - DataFlair","description":"Android Kotlin Grocery Shopping App will help the user by maintaining a list of items along with price and quantity.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/","og_locale":"en_US","og_type":"article","og_title":"Android Kotlin Project \u2013 Grocery Shopping App - DataFlair","og_description":"Android Kotlin Grocery Shopping App will help the user by maintaining a list of items along with price and quantity.","og_url":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-09-11T13:30:28+00:00","article_modified_time":"2026-06-01T08:44:44+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/android-kotlin-grocery-shopping-app.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445"},"headline":"Android Kotlin Project \u2013 Grocery Shopping App","datePublished":"2023-09-11T13:30:28+00:00","dateModified":"2026-06-01T08:44:44+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/"},"wordCount":1251,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/android-kotlin-grocery-shopping-app.webp","keywords":["android kotlin grocery shopping app","android kotlin grocery shopping app project","android kotlin project","android kotlin project ideas","grocery shopping app","grocery shopping app project"],"articleSection":["Android Kotlin Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/","url":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/","name":"Android Kotlin Project \u2013 Grocery Shopping App - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/android-kotlin-grocery-shopping-app.webp","datePublished":"2023-09-11T13:30:28+00:00","dateModified":"2026-06-01T08:44:44+00:00","description":"Android Kotlin Grocery Shopping App will help the user by maintaining a list of items along with price and quantity.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/android-kotlin-grocery-shopping-app.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/android-kotlin-grocery-shopping-app.webp","width":1200,"height":628,"caption":"android kotlin grocery shopping app"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/android-kotlin-grocery-shopping-app\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Android Kotlin Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/android-kotlin-tutorials\/"},{"@type":"ListItem","position":3,"name":"Android Kotlin Project \u2013 Grocery Shopping App"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam6\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/118635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=118635"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/118635\/revisions"}],"predecessor-version":[{"id":148688,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/118635\/revisions\/148688"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/118638"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=118635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=118635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=118635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}