How to pause UI thread until Firebase query is finished?
<p>so my question says it all. In onCreate I am attempting to query objects, but I want the UI thread to wait until im done querying all my objects so I can use them to create views that my user can see. Does anyone know how to go about doing that with example code?</p>

<p>here is how i am querying.</p>

<pre><code> Firebase cardReference = mRef.child("aReference");
        cardReference.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) {
                    CardModel fireBaseCard = dataSnapshot1.getValue(CardModel.class);
                    testCardModelArray.add(fireBaseCard);
                    cardStack.setCardModelIDInArrayList(fireBaseCard.getCardID());
                }
                setUpCardStack();
            }

            @Override
            public void onCancelled(FirebaseError firebaseError) {

            }
        });
</code></pre>

<p>Hope you guys can help!</p>