I have an Android project and I use Navigation Drawer in it, and in the MainActivity, I have a switch-case, with options and your respective positions for to open when the user clicks. But, in a class called TelaQUEMSOMOS, the parameters that are there:
public class TelaQUEMSOMOS extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.telaquemsomos, container, false);
return rootView;
}
}
are extending from Fragment and not Activity. It's bad, because I need to put a Toast.makeText or findViewById, and I can't. How can I handle it?
In your fragment you can call getActivity()
to get instance of the activity.