Select to view content in your preferred language

Feature not drawing after added to offline database, refresh map?

3528
1
07-01-2014 09:37 AM
ForrestKaye
Regular Contributor
I cannot get a new feature to draw immediately after I add it to the offline geodatabase I am using.  (It will draw once I pan or zoom) I am looking for a refresh() call but can't find any reference to it.  I saw this thread that seems similar and references a refresh() but I can't find it. 

I am assuming what ever call is necessary to refresh the map drawing I should place it in the onResume() call?


  @Override
  protected void onResume() {
    super.onResume();

    // Call MapView.unpause to resume map rendering when the activity returns to the foreground.
    mMapView.unpause();

   //refresh map/layers here?
  }
0 Kudos
1 Reply
ForrestKaye
Regular Contributor

In case anyone is having this issue or has it in the future. I Revisited this problem after some time and fixed it.

It was due to architecture issues, and was solved by creating a global variable of a Geodatabase and always using that variable for database operations.  Previously I was creating new instances of a geodatabase and using that for inserts.

So here is what I do now:

static Geodatabase localGDB; //declare global variable in main activity

localGDB = new Geodatabase("path/to/local/my.geodatabase"); //instantiate geodatabase in on create or elsewhere

MyActivityWithGlobalVar.localGDB //reference localGDB variable in other activities in this way when doing anything to it
0 Kudos