Search code examples
javaandroidtouchdb

How to call invalidate() late on ViewPager


I'm using TouchDB to replicate a DB and display its contents in a series of ListViews in a ViewPager. The problem I'm having is that on the first replication TouchDB calls it's onSuccess()/onPostExecute() methods before it's finished replicating, meaning I can't call invalidate() on my ViewPager to get it to draw the ListViews.

Is there any solution to this?


Solution

  • You can add a runnable that will invalidate to the end of your run queue.

    myView.post(new Runnable() {
      @Override
      public void run() {
        myView.invalidate();
      }
    });
    

    Does this work?