i working videoview. i wrote code witch can play video from url with asynctask.at the moment everythink is ok but i have another problem.when i run my app videoview is not full screen.
[i have like this resulit 1
this is a my source
public class Layout1 extends Fragment {
VideoView video;
MediaController media;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@SuppressWarnings("deprecation")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_layout1, null);
video = (VideoView) view.findViewById(R.id.video_view);
new BackgroundAsyncTask()
.execute(Global.yutubeDownloadUrl);
return view;
}
public class BackgroundAsyncTask extends AsyncTask<String, Uri, Void> {
Integer track = 0;
ProgressDialog dialog;
protected void onPreExecute() {
dialog = new ProgressDialog(getActivity());
dialog.setMessage("Loading, Please Wait...");
dialog.setCancelable(true);
dialog.show();
}
protected void onProgressUpdate(final Uri... uri) {
try {
media=new MediaController(getActivity());
video.setMediaController(media);
media.setVisibility(View.GONE);
media.setPrevNextListeners(new View.OnClickListener() {
@Override
public void onClick(View v) {
// next button clicked
}
}, new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
media.show();
video.setVideoURI(uri[0]);
video.requestFocus();
video.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer arg0) {
video.start();
dialog.dismiss();
}
});
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
}
@Override
protected Void doInBackground(String... params) {
try {
Uri uri = Uri.parse(params[0]);
publishProgress(uri);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
and xml code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView
android:id="@+id/video_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
what am i doing wrong? if anyone knows solution please help me