Code example for Fragment

Methods: setRetainInstance

0
  public ContentFragment() { 
    this(null); 
  } 
   
  public ContentFragment(String url) {
    super(); 
     
    urlToLoad=url;
    setRetainInstance(true);
  } 
   
  @Override 
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                            Bundle savedInstanceState) {
    return(inflater.inflate(R.layout.content_fragment, container, false));
  } 
   
  @Override 
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
Experience pair programming with AI  Get Codota for Java