Open MaherSoua opened 7 years ago
https://github.com/mitchtabian/Fragments/blob/4b0a74809f986563b694eb8ca89a595d1edb984e/Fragements/app/src/main/java/tabian/com/fragements/Fragment1.java#L49 May be we can use onAttach(Context context) in Fragment classes, like that we can get the main activity and use its public method like that I mean:
MainActivity mMainActivity; @Override public void onAttach(Context context){ super.onAttach(context); mMainActivity = (MainActivity) context; }
Do whatever works for you.
https://github.com/mitchtabian/Fragments/blob/4b0a74809f986563b694eb8ca89a595d1edb984e/Fragements/app/src/main/java/tabian/com/fragements/Fragment1.java#L49 May be we can use onAttach(Context context) in Fragment classes, like that we can get the main activity and use its public method like that I mean:
MainActivity mMainActivity; @Override public void onAttach(Context context){ super.onAttach(context); mMainActivity = (MainActivity) context; }