Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:EclipseLogcat显示已销毁的活动日志_Android_Eclipse_Android Activity_Logcat_Android Logcat - Fatal编程技术网

Android:EclipseLogcat显示已销毁的活动日志

Android:EclipseLogcat显示已销毁的活动日志,android,eclipse,android-activity,logcat,android-logcat,Android,Eclipse,Android Activity,Logcat,Android Logcat,我有一个主要的活动,叫做另一个活动。 我希望第二个活动在按下后退按钮时被完全销毁。 当我按下back按钮时,总是调用onDestroy方法,但在Eclipse LogCat中,我仍然可以看到属于已销毁活动的日志(我在屏幕方向更改时设置了这些日志)。 这是一个Eclipse bug还是我的第二个活动从未被破坏 这是我的摄影活动,在CameraActivity之后被称为: @Override protected void onCreate(Bundle savedInstanceState) {

我有一个主要的活动,叫做另一个活动。 我希望第二个活动在按下后退按钮时被完全销毁。 当我按下back按钮时,总是调用onDestroy方法,但在Eclipse LogCat中,我仍然可以看到属于已销毁活动的日志(我在屏幕方向更改时设置了这些日志)。 这是一个Eclipse bug还是我的第二个活动从未被破坏

这是我的摄影活动,在CameraActivity之后被称为:

@Override
protected void onCreate(Bundle savedInstanceState)
{

    super.onCreate(savedInstanceState);
    setContentView(R.layout.photo);
[…]
    OrientationEventListener mOrientationEventListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) 
    { 
     @Override
     public void onOrientationChanged(int orientation) 
     {

      mDeviceOrientation = orientation;

      int norientation = 90*Math.round(mDeviceOrientation / 90); 

         if(norientation == 360)
         {
             norientation = 0;
         }

        Log.d("photo","orientation function:"+norientation);
     }
    };

    if(mOrientationEventListener.canDetectOrientation())
    {
     mOrientationEventListener.enable();
    }


}
    @Override
protected void onDestroy() {
    super.onDestroy();
    Log.d("photo","destroy");
}
这是我的日志:

    09-03 09:14:54.630: D/orientation(26901): orientation:0
    09-03 09:14:55.630: D/orientation(26901): orientation:270
    09-03 09:14:55.635: D/photo(26901): orientation function:270
    09-03 09:14:55.834: D/orientation(26901): orientation:0
    09-03 09:14:55.834: D/photo(26901): orientation function:0
    09-03 09:14:56.235: D/orientation(26901): orientation:270
    09-03 09:14:56.235: D/photo(26901): orientation function:270
    09-03 09:14:56.434: D/orientation(26901): orientation:0
    09-03 09:14:56.434: D/photo(26901): orientation function:0
    09-03 09:14:56.635: D/orientation(26901): orientation:0
    09-03 09:14:56.635: D/Sensor(26901): Landscape
    09-03 09:14:56.635: D/photo(26901): orientation function:0
    09-03 09:14:56.830: D/orientation(26901): orientation:0
    09-03 09:14:56.830: D/photo(26901): orientation function:0
    09-03 09:14:57.030: D/orientation(26901): orientation:0
    09-03 09:14:57.030: D/photo(26901): orientation function:0
    09-03 09:14:57.234: D/orientation(26901): orientation:0
    09-03 09:14:57.234: D/photo(26901): orientation function:0
    09-03 09:14:57.434: D/orientation(26901): orientation:0
    09-03 09:14:57.434: D/Sensor(26901): Portrait
    09-03 09:14:57.434: D/photo(26901): orientation function:0
    09-03 09:14:57.635: D/orientation(26901): orientation:270
    09-03 09:14:57.635: D/photo(26901): orientation function:270
    09-03 09:14:57.835: D/orientation(26901): orientation:270
    09-03 09:14:57.835: D/photo(26901): orientation function:270
    09-03 09:14:58.034: D/orientation(26901): orientation:270
    09-03 09:14:58.034: D/photo(26901): orientation function:270
    09-03 09:14:58.234: D/orientation(26901): orientation:270
    09-03 09:14:58.234: D/photo(26901): orientation function:270
    09-03 09:14:58.434: D/orientation(26901): orientation:270
    09-03 09:14:58.434: D/photo(26901): orientation function:270
    09-03 09:14:58.634: D/orientation(26901): orientation:270
    09-03 09:14:58.634: D/photo(26901): orientation function:270
    09-03 09:14:58.835: D/orientation(26901): orientation:270
    09-03 09:14:58.835: D/photo(26901): orientation function:270
    09-03 09:14:59.040: D/orientation(26901): orientation:0
    09-03 09:14:59.040: D/Sensor(26901): Landscape
    09-03 09:14:59.040: D/photo(26901): orientation function:0
    09-03 09:14:59.235: D/orientation(26901): orientation:0
    09-03 09:14:59.235: D/photo(26901): orientation function:0
    09-03 09:15:39.240: W/KeyCharacterMap(26901): No keyboard for id 0
    09-03 09:15:39.240: W/KeyCharacterMap(26901): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
    09-03 09:15:39.700: D/camera(26901): onrestart:true
    09-03 09:15:39.710: D/camera(26901): camera:android.hardware.Camera@4056a410
    09-03 09:15:39.725: D/orientation(26901): orientation:0
    09-03 09:15:39.725: D/photo(26901): orientation function:0
    09-03 09:15:39.725: D/orientation(26901): orientation:0
    09-03 09:15:39.725: D/photo(26901): orientation function:0
    09-03 09:15:39.760: E/Surface(26901): Surface::init token -2 identity 2344
    09-03 09:15:39.760: D/camera(26901): camera1:android.hardware.Camera@4056a410
    09-03 09:15:39.760: D/camera(26901): camera:android.hardware.Camera@4056a410
    09-03 09:15:40.780: D/camera(26901): w=480-h=800
    09-03 09:15:40.795: D/camera(26901): rotazione
    09-03 09:15:40.795: D/camera(26901): rotation0
    09-03 09:15:40.800: D/camera(26901): parH=800-parW=480
    09-03 09:15:40.825: D/camera(26901): W=800-H=480
    09-03 09:15:41.320: D/orientation(26901): orientation:0
    09-03 09:15:41.320: D/photo(26901): orientation function:0
    09-03 09:15:41.320: D/orientation(26901): orientation:0
    09-03 09:15:41.320: D/photo(26901): orientation function:0
    09-03 09:15:41.320: D/orientation(26901): orientation:0
    09-03 09:15:41.320: D/photo(26901): orientation function:0
                          09-03 09:15:41.390: D/photo(26901): destroy
    09-03 09:15:41.684: D/orientation(26901): orientation:0
    09-03 09:15:41.684: D/photo(26901): orientation function:0
    09-03 09:15:41.885: D/orientation(26901): orientation:0
    09-03 09:15:41.885: D/photo(26901): orientation function:0
    09-03 09:15:42.684: D/orientation(26901): orientation:0
    09-03 09:15:42.684: D/photo(26901): orientation function:0
    09-03 09:15:42.884: D/orientation(26901): orientation:0
    09-03 09:15:42.884: D/photo(26901): orientation function:0
    09-03 09:15:43.084: D/orientation(26901): orientation:0
    09-03 09:15:43.084: D/Sensor(26901): Landscape
    09-03 09:15:43.084: D/photo(26901): orientation function:0
    09-03 09:15:43.285: D/orientation(26901): orientation:0
    09-03 09:15:43.285: D/photo(26901): orientation function:0
    09-03 09:15:43.485: D/orientation(26901): orientation:0
    09-03 09:15:43.485: D/photo(26901): orientation function:0
    09-03 09:15:43.685: D/orientation(26901): orientation:0
    09-03 09:15:43.685: D/photo(26901): orientation function:0
    09-03 09:15:43.885: D/orientation(26901): orientation:0
    09-03 09:15:43.885: D/photo(26901): orientation function:0

正如您所看到的,照片活动已被销毁(我在销毁日志中缩进了更多),但当我移动手机时,日志“方向功能:度”仍在继续出现。

在第二个活动的onDestroy事件之后是否添加了新的日志?是的,我不明白为什么。即使应用程序关闭(不是强制关闭,只是使用“后退”按钮),该活动的日志也会被添加。请发布您的logcat语句和相关代码,以便我们看到发生了什么。(值得一提的是,据我所知,安卓系统没有这样的小故障,所以这应该是可以修复的。)听起来好像你有公开的参考资料。确保您正在清理所有引用,尤其是任何侦听器。