public boolean waitForFragment ( String tag , int id , int timeout ) { long endTime = SystemClock . uptimeMillis ( ) + timeout ; while ( SystemClock . uptimeMillis ( ) <= endTime ) { if ( getSupportFragment ( tag , id ) != null ) return true ; if ( getFragment ( tag , id ) != null ) return true ; } return false ; }
Waits for a Fragment with a given tag or id to appear .