0

Wit this code i start an external video player and play video:

public class MenuActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);


l_video.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        String file_name="34743773";
        File path = new File(Environment.getExternalStorageDirectory() + File.separator + "AAAAA"+ File.separator +file_name+".mp4");

        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(path)));
        intent.setDataAndType(Uri.parse(String.valueOf(path)), "video/*");
        startActivity(intent);
    }
});
}
}

My problem is that when playing of video end's, entire App closes! i want that only video player closes and control goes back to my App activity. What i have to do?

Fcoder
  • 9,066
  • 17
  • 63
  • 100

1 Answers1

0

What a video player does when a video ends is up to the authors of the video player, not you. Some might just finish() their player activity, in which case control will return to you. Some might simply pause at the end, allowing the user to choose to press BACK and return to you or not. Some might do something else, like specifically bring up the home screen.

The only way for you to absolutely control the behavior of the video player is to write the video player yourself.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491