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
- Shopping cart icon (You can use your own in case you need)
- Some product images (Google it, you will find some good ones )
- Some utility icons like remove , a backdrop etc.
Now lets start. 😉
Latest posts by Kriti Nidhi (see all)
- How to send data from fragment to activity or activity to fragment in real time - April 10, 2017
- How to decompile or print java .class file. - January 17, 2017
- What is the difference between overloading and overriding ? - January 17, 2017