Android get view of fragment in activity [duplicate]
问题 This question already has answers here : findViewById in Fragment (35 answers) Closed 8 months ago . I have an activity, let's call it A , and it launches a fragment like so: remoteFragment = new RemoteFragment(); getSupportFragmentManager() .beginTransaction() .replace(R.id.frameLayout_remote_activity, remoteFragment) .commit(); my remoteFragment looks something like this: public Button okBtn; public RemoteFragment() { // Required empty public constructor } @Override public View onCreateView