]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/commitdiff
Fix application crashing issue master
authorMichal Horn <hornmich@fel.cvut.cz>
Mon, 23 Feb 2015 16:36:45 +0000 (17:36 +0100)
committerMichal Horn <hornmich@fel.cvut.cz>
Mon, 23 Feb 2015 16:36:45 +0000 (17:36 +0100)
The application crasched after approximately 10 screen rotation repetitions
with an out of memory exception.
Forcing the Garbage Collector to clean the memory from unused bitmap references
solved the problem.

On Google Glass this is no issue because there is no screen rotation feature.

QRScanner/mobile/src/main/java/cz/cvut/fel/dce/qrscanner/PreviewActivity.java

index 077656f4dfaa481d06898968976744d1b22b4588..6da19059adada5d5df060f20aa7aebb783d616dd 100644 (file)
@@ -271,6 +271,7 @@ public class PreviewActivity extends ActionBarActivity implements ViewTreeObserv
                @Override
                protected void onPreExecute() {
                        super.onPreExecute();
+                       System.gc();
                        Log.d(TAG, "Starting loading of the PDF page asynchronously.");
                        mProgressContainer.setVisibility(View.VISIBLE);
                }