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

时间:2012-08-31 15:19:56

标签: android eclipse android-activity logcat android-logcat

我有一个主要活动,它调用另一个活动。 我希望在按下后退按钮时完全销毁第二个活动。 当我按下后退按钮时总是调用onDestroy方法,但在Eclipse LogCat中,我仍然看到属于被破坏活动的日志(我在屏幕方向更改时设置它们)。 它是一个Eclipse bug还是我的第二个活动永远不会被破坏?

这是我的PhotoActivity,在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");
}

这是我的LogCat:

    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

正如你所看到的那样,照片活动被破坏了(我更多地缩进了破坏日志),但是当我移动手机时,日志“方向功能:度”会继续出现。

0 个答案:

没有答案