There is a fragment:
public class CurrentFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_current, null); return view; } public void GetCurrInfo(String url){ final WebView current_web = (WebView) view.findViewById(R.id.current_web); } } But when I want to connect the WebView in the GetCurrInfo method, the view is red. I know why it does not work, but I do not know how to do it right.

getView()withtry/catchNPE, orviewclass variable - Jarvis_JgetView()works. Do I have to use NPE processing? - Roman Shubenko pmtry/catchwill help in such rare cases not to fly the entire program. - Jarvis_J