Code example for Fragment

Methods: getActivitygetArgumentsonStart

0
    private String mUrl = null;
 
     
    @Override 
    public void onStart() { 
        super.onStart(); 
 
        // During startup, check if there are arguments passed to the fragment. 
        // onStart is a good place to do this because the layout has already been 
        // applied to the fragment at this point so we can safely call the method 
        // below that sets the article text. 
        Bundle args = getArguments();
        if (args != null) {
            // Set article based on argument passed in 
        	mUrl = (args.getString("url"));
        } 
         
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
         
        try { 
    	  PackageManager pm = getActivity().getPackageManager();
    	  ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
    	  if (ai == null)
    	        mWebView.setWebChromeClient(new WebChromeClient());
        } catch (NameNotFoundException e) {
	        mWebView.setWebChromeClient(new WebChromeClient());
Experience pair programming with AI  Get Codota for Java