Are fragments running on a separate thread than the activity they were created on?
So let’s say I have a fragment that calls a web-service synchronously, does it also block my main activity while retrieving data from the server?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would assume they’re on the UI thread, since Android makes such a big deal keeping UI actions on the UI thread. When calling
commit(), those transactions are definitely performed on the UI thread, as stated in the documentation.Seems like you could test it pretty easily with
If it’s on thread ‘main’, then it’s on the UI thread.