Activity:Fragment Boss


#1

Hi,

I’m new to the forum and new to Android programming. I have a question that relates to the Fragment Boss. I am using that concept and it worked great until I needed to add a download process for Google Play. I attempted to implement the code from the SampleDownloader. I am performing this task in “onCreate” from my main activity that extends SingleFragmentActivity. In “onCreate” I want to put the UI that will handle downloading the file from Google Play, if the file was not found. However, since this activity returns a fragment, the UI will not display. I get the error "no view found for the fragment that I returned’. I tried to create a fragment to handle the download, but it didn’t work either. I need to get the file before the application displays. With the activity that extends “SingleFragmentActivity” and using fragments, what is the best method to download a file before the app begins. Any suggestions would be greatly appreciated. Love the book, but can’t seem to successfully make the proper changes for downloading a file. :neutral_face:


#2

Glad to hear you like the book!

I don’t think you’re going to have any luck downloading the file before the app begins, though. Once your activity has started and onCreate has been called, it’s show time, and the user will need to see something that accurately reflects what’s going on. It sounds like in this case that would be a progress indicator of some kind.

Good luck! And let me know if you have any other questions.


#3

Thanks for your reply. Just your tip about “onCreate” caused me re-think what I was doing and I got it to work.