Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25803] Android: Improve Imageview cache on devices with lesser ram

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 7.1.0, Release 7.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterLokesh Choudhary
AssigneeGary Mathews
Created2018-02-24T00:38:24.000+0000
Updated2018-02-26T18:39:29.000+0000

Description

Steps to reproduce:

1. Use the code below in your app.js:
var window = Ti.UI.createWindow(),
    tableView = Ti.UI.createTableView(),
    start = Ti.UI.createButton({
        title: 'START',
        left: '10dp',
        bottom: '10dp',
    });

start.addEventListener('click', function(e) {
    Ti.Media.openPhotoGallery({
        allowMultiple: true,
        allowEditing: false,
        autohide: true,
        mediaTypes: Ti.Media.MEDIA_TYPE_PHOTO,
        success: function(e) {
        
            for (let i in e.images) {
                var row = Ti.UI.createTableViewRow({title: e.images[i].media.file.name});

                row.addEventListener('click', function() {
                    var child = Ti.UI.createWindow();
                    child.add(Ti.UI.createImageView({
                        image: e.images[i].media
                    }));

                    child.addEventListener('open', function(){
                        setTimeout(() => { child.close() }, 1000);
                    });

                    child.open();
                });

                tableView.appendRow(row);
            }
        }
    });
});

window.add([tableView, start]);
window.open();
2. Build for android device with lesser ram like Nexus 5. 3. After the app launch tap start & select photos from the device. 4. They will appear in a tableview. 5. Tap each tableviewrow to open the image. 6. Image should open in an imageview & close after a timeout of 1000ms i.e 1 sec. 7. Continue doing this for few trys.

Actual results:

1. We see an app crash & error :
[ERROR] :  JavaObject: !!! OH NO! We tried to move a weak Java object back to strong, but it's aleady been GC'd by JVM! We're in a bad state! Key: 1449486177
2. According to [~gmathews], this can be improved by improving the imageview cache.

Expected result:

1. The app should not crash & the images should keep opening in the imageview.

Comments

No comments

JSON Source