Basically I need the functionality of onWindowFocusChanged() but on a Fragment.
The onWindowFocusChanged() listener isn’t actually available to fragments unfortunately, so I’m not sure what to do.
Any way to do this?
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.
Fragments are “drawn” via the
Viewyou return inonCreateView(). You can use the event handlers in that. Usually, if there’s a command that needs to be run when theViewfirst comes to view, you can assign it in aRunnableand attach it to theViewvia thepost()method.