How we can handle below scenario? suppose a book is downloading and we need to open book as soon as it downloads

how we can handle below scenario? suppose a book is downloading and we need to open book as soon as it downloads.while book downloading percentage loader display…

There is not enough detail in this scenario, so my suggestions might not be applicable for you.

I would create a WebDriver wait that repeatedly checks for the existence of the android.widget.ProgressWheel view element that would represent the loading bar (if your app has a custom view, you might need to check for a different class type for the the loading bar). I assume that at 100%, the ProgressWheel is dismissed, so my WebDriver wait then returns in my test code. My testing code will then proceed to tap on the button that replaces the ProgressWheel to show whatever view contents your application intends to show.

yes… but can u give some sample code for wait…
as i tried with different wait but its not working
Basically scenario includes:

1.book downloading
2.while book downloading percentage loader will display on thumbnail image of book
3.after download,open button display.