webview - Android - Using Fragments -


i'm new java, , android development. want able display local page page within app using fragments (because don't want entire app web based).

so, i've gone arview.xml , added fragment:

<fragment         android:id="@+id/fragment_bbc"         android:name="android.webkit.webviewfragment"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_alignparentleft="true" /> 

now, want place web page in there (for now, i'll use bbc website).

within 'oncreate(bundle savedinstancestate)' have this:

webfrag = (webviewfragment) mguiview.findviewbyid(r.id.fragment_bbc); mwebview = (webview) mguiview.findviewbyid(r.id.fragment_bbc); mywebview.loadurl("http://www.bbc.co.uk"); 

i have errors of 3 of lines, saying can't resolved.

where going wrong? thanks

you shouldn't use "tag" fragment in xml, classic layout , use in class extend fragment

example :

    @override     public view oncreateview(layoutinflater inflater, viewgroup group, bundle saved) {         _view = inflater.inflate(r.layout.fragment_accueil, group, false);         // views         _textviewtitle = (textview) _view.findviewbyid(r.id.title_home);         _buttonlocalsearch = (button) _view.findviewbyid(r.id.btn_local_search);         return _view;     }       @override     public void onactivitycreated(bundle savedinstancestate) {     {           _textviewtitle.settext(getactivity().getstring(r.string.tle_home));           _buttonlocalsearch.setonclicklistener(this);     } 

Comments

Popular posts from this blog

ruby on rails - Is it the correct way to implement belongs_to relation with factory girl? -

geolocation - Windows Phone 8 - Keeping background location tracking active beyond four hours -

Uncaught TypeError: Cannot read property 'parentNode' of null javascript -