Reputation: 4717
I am developing a news application.
At the main page, I am fetching the news from a server, using JSON.
I am putting the title of this new in the listview alongside a thumbnail image. The main text of the news (which might be more than 15 lines) does not appear here.
Where I want it to appear is when the user clicks on the title in a specific row in the ListView, the user is taken into a new activity, where a bigger image is shown, alongside the title and the text of the news.
My question is the following. - Which approach is better ?
1 - getting all the data in the first listview, and send them as extras to the second page ? (my concern is that the jsons can get a bit too long sometimes) and show them there ?
2 - just get the title in the first listview, and get another link for the big text (and images) then when the user clicks on the news, open the other activity, and re post/get the data this time with the new link.
Any other suggestions are welcomed.
Upvotes: 2
Views: 130
Reputation: 7798
Roughly if you don't want your app to work offline @Karthik Palanivelu is right, and you should only request the extra data if the user wants to read it.
If you do, then that really depends on how many items your list has and how much do you care about the data traffic. If you have 1000 items, 15 lines, let's say 100 characters per line. That's roughly 1,5Mb. Might be a lot if the user is using mobile data, but also might be a little bit if the user is on Wifi. I personally like to give the user the option to always browse the app offline, so in that case I would fetch all the text right away. (Or at least some of the options, maybe the latest 100 or so. But that's my personal opinion)
Bear in mind that's just for the text, you should not fetch all the large images, or it'll consume a lot. Nowadays a lot of people use mobile data, so you should always try to keep the data consumption at a minimum but also give the user a nice experience.
Upvotes: 1
Reputation: 856
I would prefer the second option. Because user might not be interested in all the news. Practically, user will read only few news. Say 4 or 5. If you do by second option, you will be fetching only those 4 or 5 data. You fetching all the available data at once will consume large data traffic and time to load the list.
Upvotes: 3