I created a new View class. Within that class I need to get access to the FragmentManager, but I cannot figure out how.
Can I access the FragmentManager from a context?
CustomView extends LinearLayout
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.
Only if the given Context extends Activity (Post-Honeycomb) or FragmentActivity (pre-honeycomb).
In which case you’d have to make 100% sure it’s an activity using reflection or try-catch.
Thought I recommend refactoring so a
Viewis really just meant for showing stuff and shouldn’t actually modify the state of your app, but that’s my opinion.