vendredi 19 septembre 2014

Interaction between two Fragments not working, but crashing app


Vote count:

0




I've been trying to interact between two fragments, but it has not been successful. I have an Activity that holds two ListFragment. FragmentA downloads a JSON data and stores it in a ContentProvider and I load the Data from the CP and populate it on my ListView. The data downloaded and stored is needed by FragmentB. So, at first I did initialize the method to get the data from the ContentProvider stored in FragmentA. But, it's like it never does go into the fragmentB at all. So, I called the method loading the data from the *ContentProvider in FragmentB from FragmentA, and that crashes the App. I don't seem to know what to do atm. A senario of my code is below:



public class FragmentA extends ListFragment{

public void downloadJson(){

/...
....
..../

loadContentProvider();
}

public void loadContentProvider(){

/..../
FragmentB frag = new FragmentB;
frag.loadContentProvider();
}
}

public class FragmentB extends ListFragment{

public void loadContentProvider(){


}
}


Just a way to notify FragmentB to load it data from the ContentProvider Thanks



asked 28 secs ago







Interaction between two Fragments not working, but crashing app

Aucun commentaire:

Enregistrer un commentaire