My solution
1-Singleton to keep 1 istance of your data
2-Service store data in singleton
3-In onCreateView of Fragments keep data from singleton ad display data
This is my solution for your 2nd point
For 3rd point, you can implement serializable in your object and pass it with an intent from your listActivity to your DetailActivity (in listActivity it's easy get the object in Array by position)
EDIT
SINGLETON
public class GlobalVarSingleton {
private static final String TAG = "GlobalVarSingleton";
private static GlobalVarSingleton mInstance = null;
private static myObj token;
private GlobalVarSingleton(){
}
public static GlobalVarSingleton getInstance(Context ctx){
if(mInstance == null)
{
Log.d(TAG, "init Global Singleton");
mInstance = new GlobalVarSingleton();
}
return mInstance;
}
public void setData(myObj data){
this.token = data;
}
public myObj getData(){
return token;
}
}
To access -> GlobalVarSingleton.getIstance(context).setData(data); (or getData...) this allow you to have a single istance of your object in app. The best it's init this Singleton in Application class
public class MyApplication extends Application {
@Override
public void onCreate()
{
super.onCreate();
GlobalVarSingleton.getInstance(this);
}
}
So in Service you just need call setData it as up and pass your data just getted. myObj is a sample, you must use your data object offcourse.
In CreateView with GlobalVarSingleton.getIstance(this.getActivity()).getData();
you get data storaged
For serializable look it Passing data through intent using Serializable
Note, it's important that you know when data is available, I think that you wait web response to load new listActivity, is it right?
ABOUT APPLICATION CLASS http://developer.android.com/reference/android/app/Application.html