Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1830] Android: FC when trying to open lightweight window with Mapview a second time

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:57:17.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
ComponentsAndroid
Labelsandroid, defect
ReporterBill Dawson
AssigneeBill Dawson
Created2011-04-15T03:03:24.000+0000
Updated2011-04-17T01:57:17.000+0000

Description

Simple failcase app.js:


Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({  
    title:'Map Test', backgroundColor:'#fff',
    fullscreen: true, exitOnClose: true
});

var open = Ti.UI.createButton({title: 'Open mapview window'});
open.addEventListener('click', function(){
    var w2 = Ti.UI.createWindow({title: 'Map View', backgroundColor: 'green'});
    var mapview = Titanium.Map.createView({
        mapType: Titanium.Map.STANDARD_TYPE,
        region: {latitude:33.74511, longitude:-84.38993, 
                latitudeDelta:0.01, longitudeDelta:0.01},
        top: 0, left: 0, right: 0, height: 300
    });
    w2.add(mapview);
    var close = Ti.UI.createButton({title: 'close', top: 305});
    close.addEventListener('click', function(){ w2.close(); });
    w2.add(close);
    w2.open();
});
win.add(open);

win.open();

The map activity only gets destroyed when the "parent" activity gets destroyed. Since lightweight windows don't have their own activities, destroy doesn't occur. If you try to the same or another window with a mapview, it will therefore fail.

We need a way to get that map activity destroyed even when the host window is lightweight. In the past we've told some users about an undocumented hack, calling mapview.OnDestroy. But we shouldn't do that as it's not cross-platform and may be unavailable with new Kroll.

Comments

  1. Bill Dawson 2011-04-15

    (from [4fc1e678d66860acfedd139baf486f849eb934b8]) [#1830 state:fixed-in-qa] Take care of destroying map activity by overriding and hooking into releaseViews(). http://github.com/appcelerator/titanium_mobile/commit/4fc1e678d66860acfedd139baf486f849eb934b8"> http://github.com/appcelerator/titanium_mobile/commit/4fc1e678d6686...

  2. Thomas Huelbert 2011-04-15

    confirmed on a G1 running 1.6, leaving in my pile till I get a 2.1 and 2.2 device to close against.

  3. Thomas Huelbert 2011-04-15

    oops, did not set ticket state

  4. Thomas Huelbert 2011-04-15

    and again, lol

JSON Source