I have an application that fetches some text from a web page , and displays it on the screen. I would like to put after the text a video from the web . How could I do that ? If I do like the following code , the application crashes ( Null pointer exception) .
My code :
LinearLayout tt= (LinearLayout)findViewById(R.id.kiu);
WebView webview;
tt.addView(fin); // fin is the TextView
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://www.youtube.com/embed/j4Wmjl7jxQo");
tt.addView(webview);
main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:scrollbars="vertical"
android:background="#FFFFFF"
>
<LinearLayout
android:id="@+id/kiu"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="0dp">
</LinearLayout>
</ScrollView>
I can't figure out what should I do .. I would like my app to display this instead of this .