Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Confirm that Child Activity has been finished before starting that child again?
    primarykey
    data
    text
    <p>I have a parent activity A which has two childs activities B and C. When I open Parent Activity A it decides which child activity have to open. (function using <code>startActivityForResult</code>) eg. A decide to open B. B plays Video and return result to back. thats fine next if A decide to open B again. B is not opening fine (not playing video). </p> <p><strong>Note:</strong> Following is Fine:</p> <p>A-->B and A&lt;--B</p> <p>then</p> <p>A-->C and A&lt;--C</p> <p>then</p> <p>A-->B and A&lt;--B</p> <p>But Following is Not Working:</p> <p>A-->B and A&lt;--B</p> <p>then</p> <p>A-->B and A&lt;--B //When try to move again on B. I think A is calling B again before it finished</p> <p>then</p> <p>A-->C and A&lt;--C</p> <p>Any Idea to solve this problem??</p> <p>Mean how can i get that child activity has beed finished before calling that child again??</p> <p>Following is the code of Parent Activity:</p> <pre><code>@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.d(Constants.TAG,"requestCode: "+requestCode+" : resultCode : "+ resultCode); finishActivity(requestCode); playProgram(requestCode); } private void playProgram(int requestCode){ if(requestCode == QUESTION_WRAPPER){ currentChap = currentChap + 1; Intent intent = new Intent(MovieWrapperActivity.this, VideoWrapperActivity.class); intent.putExtra("chaptertoplay", currentChap); intent.putExtra("videofile", Constants.mCourse.getmChapters().get(currentChap).getVideoURL()); startActivityForResult(intent, MOVIE_WRAPPER); }else if(requestCode == MOVIE_WRAPPER) { if(Constants.mCourse.getmChapters().get(currentChap).isQuiz()){ Intent in2 = new Intent(MovieWrapperActivity.this, QuestionWrapper.class); in2.putExtra("chaptertoplay", currentChap); startActivityForResult(in2, QUESTION_WRAPPER); }else{ currentChap = currentChap + 1; Intent intent = new Intent(MovieWrapperActivity.this, VideoWrapperActivity.class); intent.putExtra("chaptertoplay", currentChap); intent.putExtra("videofile", Constants.mCourse.getmChapters().get(currentChap).getVideoURL()); startActivityForResult(intent, MOVIE_WRAPPER); } } } </code></pre> <p>Code of B:</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) return; setContentView(R.layout.videoview); init(); mVideoView = (VideoView) findViewById(R.id.surface_view); mVideoView.setVideoPath(videoPath); mVideoView.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH); mController = new MediaController(this); mVideoView.setMediaController(mController); mVideoView.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer arg0) { Log.d(Constants.TAG,"Completed"); Intent returnIntent = new Intent(); setResult(RESULT_OK, returnIntent); mVideoView = null; mController = null; finish(); } }); } </code></pre> <p>I think Media Elements in B are taking time to destroy or not even being destroyed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload