Please see the code @Override public void onCompletion(MediaPlayer mp) { CompleteFlag = true; video.pause(); /* */ if(checkNetworkConnection()){ try { new PostUsesData().execute("T"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } // set the message to display EncryptVideo(IDValue); alertbox.setTitle("Message"); alertbox.setMessage("Do you want to delete this video ?"); // set a positive/yes button and create a listener alertbox.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
// do something when the button is clicked public void onClick(DialogInterface arg0, int arg1) { try { new File(path).delete(); Intent myIntent = new Intent(VideoPlayer.this, WatchActivity.class); // here myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(myIntent); /* Toast.makeText(getApplicationContext(), "Thanks,Inprogress..", Toast.LENGTH_SHORT).show();*/ } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); alertbox.setNegativeButton("No", new DialogInterface.OnClickListener() { // do something when the button is clicked public void onClick(DialogInterface arg0, int arg1) { showDialog(0); } }); // display box alertbox.show(); // IntroFaceBookScreen.mFacebook.dialog(this, "stream.publish", parameters, this); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK) { activitySwitchFlag = true; try { if(!CompleteFlag) { _HomeDBHANDLING(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } // activity switch stuff.. } return super.onKeyDown(keyCode, event); } @Override public void onPause(){ super.onPause(); Log.i("TAG", "onPause" ); try { EncryptVideo(IDValue); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if(activitySwitchFlag) { Log.i("TAG", "activity switch"); } else{ Log.i("TAG", "home button"); finish(); // video.pause(); // _HomeDBHANDLING(); } activitySwitchFlag = false; } Here i am decryption video after pause method call. when my video is completely played by me then after dialog appear , canceling the dialog and pressing back button then issue else when video is not finished then back btn key woks fine but when complete video played then back issue : 11-23 16:00:46.909: D/NativeCrypto(26483): Freeing OpenSSL session 11-23 16:00:47.655: D/dalvikvm(26483): GC_FOR_MALLOC freed 106167 objects / 3255768 bytes in 43ms 11-23 16:00:48.401: D/dalvikvm(26483): GC_FOR_MALLOC freed 104392 objects / 3097616 bytes in 42ms 11-23 16:00:49.351: D/dalvikvm(26483): GC_FOR_MALLOC freed 104293 objects / 3096888 bytes in 42ms 11-23 16:00:50.218: D/dalvikvm(26483): GC_FOR_MALLOC freed 104664 objects / 3098584 bytes in 43ms 11-23 16:00:51.030: D/dalvikvm(26483): GC_FOR_MALLOC freed 104885 objects / 3097824 bytes in 41ms 11-23 16:00:51.843: D/dalvikvm(26483): GC_FOR_MALLOC freed 104612 objects / 3097288 bytes in 48ms 11-23 16:00:52.628: D/dalvikvm(26483): GC_FOR_MALLOC freed 104411 objects / 3098040 bytes in 47ms 11-23 16:00:53.440: D/dalvikvm(26483): GC_FOR_MALLOC freed 104515 objects / 3098000 bytes in 41ms 11-23 16:00:54.218: D/dalvikvm(26483): GC_FOR_MALLOC freed 104495 objects / 3096672 bytes in 42ms 11-23 16:00:55.101: D/dalvikvm(26483): GC_FOR_MALLOC freed 104277 objects / 3098024 bytes in 47ms 11-23 16:00:55.855: D/dalvikvm(26483): GC_FOR_MALLOC freed 104492 objects / 3097936 bytes in 43ms longs time On Wed, Nov 23, 2011 at 3:40 PM, skink <psk...@gmail.com> wrote: > > > On Nov 23, 10:43 am, NaveenShrivastva <kumarnaveen.si...@gmail.com> > wrote: >> In case of Home and Back event both cases calls the android pause >> method of activity life cycle. >> >> >> > > i dont understand you well, but if you simply say that onPause() is > called after both home and back jey is pressed, you already discovered > everything, what do you need more? (except the fact you cannot handle > home key in your app of course) > > pskink > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en