Android Basics: Networking [on hold]

I am new to Android Development and trying to learn it. Currently I am using Udacity to learn Android.

I just learned the Networking basics and now I want to implement this idea into an app where the data is fetched from the URL in JSON format and parse the data. This is fine and completed this part. Now I am having some trouble in displaying the data in the ListView with FragmentPagerAdapter and within that there are Fragment. There are two Fragment completed task and upcoming task and in the JSON reply the task will be identified using the task status.

If anyone can help me in understanding what is the best way to achieve this solution with least network call.

Here is a sample JSON response.

{   "response": {     "success": true,     "message": "Results Found",     "data": {       "response": {         "created": [           {             "name": "Test Task1",             "status": "upcoming",           },          {             "name": "Test Task1",             "status": "completed",           }         ]              }     }   } } 

The problem I am facing is as follows :-

I have a Main Activity java file, A Fragment Manager java file, and Two Fragment java file (Completed Task and Upcoming Task).

I have have Query Utility class which queries the URL and fetch the data.

Now the problem is where should i call the LoaderManager to fetch the data asynchronously to have the less network call and work efficiently?

I am using it in the Fragment java file but as the same data is returned from the URL for each call to the URL so two fragments calling separately on the network. As you can see from the URL the response will be differentiated just based on the status on the two fragment i.e "status" in the reply.

I think Main Activity will be the best place to call the LoaderManager but then how to pass the data to the Fragments.

Please suggest the best way to call the LoaderManager with less network call.

Thank you all in advance.


Category: networking Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.135 (s). 12 q(s)