Friday, 15 July 2011

android aar persist callback to MainActivity -


I have an AAR library and I am implementing Google patterns with an interface. My problem is that when I Let's start a new activity in this library and I need to recover some data from the main project when the user opens many other apps, then the memory needs to be cleaned, so when my app is re-opened I lose main activity And I am getting nimble while trying to get some data from the listener.

This is my class where I put my listener when the pieces are loaded

  public class ContentCfg {personal static ContentCfg example; // Listener Private Static Content Manfragment to handle other module tasks. OnfragmentInternational Listener listener; Public stable synchronized ContentCfg getInstance () {if (example == zero) {example = new ContentCfg (); } Return Example; }}  

As you see, the problem occurs when the example is zero.

My listener is in this way

  Public Interface OnFragmentInteractionListener {// Contact methods public string getDisplayNameForUid (string contact UID); }  

The main project should search in DB to return the data, and not only I can store in SharePreferences or something like that.

How do you manage it? AAR knows nothing about the main project and its orbits. So, how to get information from main project in any other activity in the library?

Thanks


No comments:

Post a Comment