Skip to main content

How to send data from fragment to activity or activity to fragment in real time

Sending data from activity to fragments and fragments to activity might be confusing in android, but we can easily solve this using interfaces. Interfaces are widely used in android for making app functionally dynamic. It can be used as custom event listeners, data update in UI and many more. Today we’ll talk about using interfaces for sending data from one activity to another or fragment and vice-verse.

Let us start with building an application where we can add or remove products and the product count reflects in our shopping cart as a notification icon.

  • First of all we will need some ready made ingredients, for our app :

You can check the following links below

  1. Shopping cart icon (You can use your own in case you need)
  2. Some product images (Google it, you will find some good ones )
  3. Some utility icons like remove , a backdrop etc.

Now lets start. 😉

 

Kriti Nidhi

Kriti Nidhi

Kriti Nidhi is a tech enthusiast and a geeky programmer. She holds passion about programming and new technologies.
Kriti Nidhi

Leave a Reply

Your email address will not be published. Required fields are marked *