How to Tag New Products And Remove The "new" Tag After A Period Of Time in android

Viewed 105

I'm creating an android app that will display list of items. Items are fetch from server with the help of an API. To show the list of items I am using Recycler view.

How to put logic to show an item is new in the list of products?

In any online shopping app like Amazon or Shopify we saw new tag for the new product I want to implement that. I don't have any code but I want a hint or way how to do. I am using JAVA language. IDE Android studio.

1 Answers

I can think of two ways it could be done easily.

  1. If you can modify the API, i.e you have access to API code, you can modify the data it is returning to add a boolean field (isNew). You can use it to display a tag in your UI.

  2. If you don't want to change your API code and just want to add a tag in your app, you can check when that product was created. For example, if a product was created/published less than 3 days ago, it's New. Else not. Depending on your criteria of new products. I hope that solves your problem.

Related