Doubt with Intents

0

I use IntentService to get my Bank data on the internet. and I am passing the data from intentservice class to Activity with intent use. My doubt is how much data I can pass via.

The user will view these items in an infinite list until the last record of the bank. These items are passing to an Arraylist within the IntentService.

Should I manage the search according to the roll of the list? How to clean the ArrayList when scrolling the list? to not have a gigantic ArrayList?

    
asked by anonymous 09.03.2018 / 19:34

1 answer

0

It's not very good for you to show all the bank records. Very rarely will the user want to see everything, the most important in the context of the app are the ones that you should prioritize. Ideally, you should only show more information when the user requests it.

And to solve this problem, you can create an endpotint in your webservice that receives as a parameter the number of items to be returned. If you have the REST architecture, an example would be: endereçoDoWebService/itens/10 , which would return the last 10 items.

On Android, you would add a listener to the RecyclerView, or whatever other view you're using to display the items, and, whenever you reach the end of the scroll, you make a request to your webservice for more items, and when they return, you add them to your list.

The Facebook app, for example, only loads more information in your feed when you arrive at the end of the current list or when you swipe to refresh.

    
10.03.2018 / 20:42