File tree Expand file tree Collapse file tree
Yolo/android/app/src/main/java/com/example/executorchyolodemo Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,6 +97,30 @@ protected void onCreate(Bundle savedInstanceState) {
9797 }
9898 }
9999
100+ @ Override
101+ protected void onDestroy () {
102+ super .onDestroy ();
103+
104+ // Clean up the detection pipeline
105+ if (detectionPipeline != null ) {
106+ detectionPipeline .close ();
107+ detectionPipeline = null ;
108+ }
109+
110+ Log .d (TAG , "BirdDetectionActivity destroyed" );
111+ }
112+
113+ @ Override
114+ protected void onPause () {
115+ super .onPause ();
116+
117+ // Optional: Release resources when app goes to background
118+ if (detectionPipeline != null ) {
119+ detectionPipeline .close ();
120+ detectionPipeline = null ;
121+ }
122+ }
123+
100124 private void initializeViews () {
101125 previewView = findViewById (R .id .previewView );
102126 overlayImageView = findViewById (R .id .overlayImageView );
@@ -432,4 +456,4 @@ protected void onResume() {
432456 super .onResume ();
433457 updateSessionUI ();
434458 }
435- }
459+ }
You can’t perform that action at this time.
0 commit comments