Android Video Layout and backbutton to activity
Posted
by Marcjc
on Stack Overflow
See other posts from Stack Overflow
or by Marcjc
Published on 2010-05-07T12:54:38Z
Indexed on
2010/05/07
12:58 UTC
Read the original article
Hit count: 288
I have an application where you can click on a button, this takes you to a new activity with four new buttons, listen, bio, ringtone, and watch. My watch button kicks off the following code:
Button cmd_watchme = (Button)this.findViewById(R.id.watch);
cmd_watchme.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
setContentView(R.layout.tvvideo);
VideoView video=(VideoView)findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(andy.this);
mediaController.setAnchorView(video);
video.setMediaController(mediaController);
video.setVideoURI(videopath);
video.start();
}
});
After the video is displayed I am trying to get the backbutton on the phone itself to take the user back to the four button selection activity, listen, bio, ringtone, and watch.
Question is, how do i do this? I was figuring if there was a way to change the ContentView after the video is displayed back to the main one for the four button page but could not figure it out. When I press the backbutton on the device, it takes me two levels up to the main selection activity not the four button activity.
I hope this was somewhat clear.
Thanks for any help.
© Stack Overflow or respective owner