In an Android application using Firebase, I need to execute long operations in background once Firebase returns a query answer. E.g.:
query.addListenerForSingleValueEvent(new ValueEventListener() {
   @Override
   public void onDataChange(DataSnapshot data) {
         dosomething very long. . .
         then call a callback forUI thread
   }
I know that firebase execute the query in asynchronous mode but the onDataChange() method seems to be always executed in the main UI Thread, even if I try to call the query in a custom background Thread. 
Does anyone knows how to manage this use case?