小编Ale*_*lex的帖子

不总是调用actation onDestroy

我正在开发一个无线电流应用程序和一个主屏幕小部件.问题是当我杀死应用程序时,我想修改主屏幕小部件中的图像,如下所示:

@Override
protected void onDestroy() {
    //update widget
    WidgetIntentReceiver.updateWidgetFromActivityDestroy(getApplicationContext());

    mMediaPlayer.reset();
    mMediaPlayer.release();
    mMediaPlayer = null;

    System.out.println("End onDestroy -> stop stream");

    super.onDestroy();
}
Run Code Online (Sandbox Code Playgroud)

但是并不总是调用修改窗口小部件的代码(不显示"System.out.println").我已经读过onDestroy并不总是被调用.但我没有找到另一种解决方案?

谢谢.

android android-activity

0
推荐指数
1
解决办法
478
查看次数

标签 统计

android ×1

android-activity ×1