android
how to load new content in linear layout android using fragment?
As we load Webview in fragment like this: private WebView viewer = null; #Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { viewer = (WebView) inflater .inflate(R.layout.tut_view, container, false); return viewer; } public void updateUrl(String newUrl) { if (viewer != null) { viewer.loadUrl(newUrl); } } But i wanted to use linear layout instead of webview. I try this but errors come out. private LinearLayout viewer ; #Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { viewer = (LinearLayout) inflater.inflate(R.layout.tut_view, container, false); View fragment = inflater.inflate(R.layout.tut_view, null); return viewer; } public void updateUrl(String newUrl) { if (viewer != null) { } }
You should have LinearLayout as root in your xml file. Also you do not need to cast the inflated view as return type is View. Please read the fragment spec.
Related Links
open App from google calendar Android
Auto Page Refresh/Reload function android
Android Media palyer by FFmpeg2.3.3 and SDL2-2.0.3 has a error when SDL_init().The error is about SDL_main.h
Unable to display AlbumArt in RemoteMediaController while casting from sender
Android spinner prompt
How to finish activity from service class in android?
Can't i add android-17,android-18 etc platforms in android studio?
RSA Publickey implemenation in android
What i should write in Pro-guard Files to stop reverse engineering android?
CreateProcess error=206, The filename, or extension is too long
GPS code returning last location
User Defined Target in Rajwali-Vuforia
Android widget listview swipe to remove item
my page does not display all the content on android
Passing a parameter in Raw SQL Ormlite
Android conditional permissions