Created
November 1, 2016 13:06
-
-
Save ZaeemSattar/be6cc9edf019c72786c5625038a597b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Insta extends Fragment { | |
WebView webView; | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, | |
Bundle savedInstanceState) { | |
View root = inflater.inflate(R.layout.activity_my_insta, container, | |
false); | |
webView=(WebView)root.findViewById(R.id.webView); | |
WebSettings webSettings=webView.getSettings(); | |
webSettings.setJavaScriptEnabled(true); | |
webView.loadUrl("https://instagram.com"); | |
webView.setWebViewClient(new MyWebViewClient()); | |
getActivity().setTitle("Instagram"); | |
return root; | |
} | |
private class MyWebViewClient extends WebViewClient { | |
@Override | |
public boolean shouldOverrideUrlLoading(WebView view, String url) { | |
view.loadUrl(url); | |
return true; | |
} | |
@Override | |
public void onPageFinished(WebView view, String url) { | |
super.onPageFinished(view, url); | |
} | |
} | |
} |
OnAttach method functionality in this code ?? in fragment i used this method to cast my interface variable into the calling activity variable..
just like
public void onAttach(Activity activity) {
myInterfaceVariable = (InterFace) activity;
}
then we can send values to activity from fragments by this
myInterfaceVariable.methodName(myValues);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can initialize it in onCreate in Acivity and onCreateView in fragment
Below is code snippet
public class DcsAdmissonPortalFragment extends BaseFragment {
LinearLayout progressbar;
}