1

I need an advice. I am creating an android application that have multiple List Activities. Selection of item from on list, results in another list and on selecting item from second list, am image is display. All the data (for list as well as images) comes from web server. I have created services in PHP to feed data to android application. I want to optimize application as much as I can. My question is that what is better, get all the data at once from server or fetch only the relevant data when user select an item.

The plus point of first approach (that I can think of) is that user will have to wait only for the first time. After the data is loaded, application will run faster as there wont be any further calls to server. Negative point (that I can think of) is that application will consume more memory.

Which approach should I follow in order to make app more efficient and user friendly?

sadaf
  • 669
  • 2
  • 7
  • 18

2 Answers2

1

As per my suggestion don't go for the first approach(Fetch data at once) because let say if you have small data right now but if you think of future than this will cause problem for you. So instead of fetching all the data at once, do whenever its necessary. You can also use the concept of Lazy loading so that your you will get good result. And fetching data lazily will be good approach of doing it.

For Lazy loading here is some resources :-

Android: Implementing progressbar and "loading..." for Endless List like Android Market

Lazy load of images in ListView

Lazy Load images on Listview in android(Beginner Level)?

So I recommend you to use LazyLoading concept in your requirement. Hope this helps.

Community
  • 1
  • 1
Scorpion
  • 6,447
  • 14
  • 72
  • 114
1

You should watch Reto Meier's Google IO 2012 talk - https://www.youtube.com/watch?v=PwC1OlJo5VM.

In it he talks about mobile radios and explains why its better for battery life to fetch all your data at once. It's a great talk and worth while.

Unless you have crazy amounts of data in your list views, memory shouldn't be much of a problem.

athor
  • 6,682
  • 2
  • 31
  • 37