Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1490] Android: Race condition of Window focus/blur

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2012-08-20T15:45:55.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, defect
ReporterDon Thorp
AssigneeNeeraj Gupta
Created2011-04-15T02:54:11.000+0000
Updated2017-03-22T20:51:06.000+0000

Description

Not sure how to address this one. It appears that the Android OS doesn't guarantee when it will call events on activities. For example it's possible for a hidden activity to have onStart called before onStop. Or it at least appears that way. It doesn't provide. Therefore it's not possible to successfully destroy a single resource like MapView.

See http://developer.appcelerator.com/helpdesk/view/30371">Helpdesk 30371

Comments

  1. Keith Gable 2011-12-13

    I have this problem. Focus and blur seem to only fire when the window is initially opened/closed, and not after that point. I have to synthesize focus/blur events like so:
       open: function(params) {
       	var self = this;
       	self.win.open(params);
       
       	if (Ti.Platform.name == "android") {
       		self.focus(); // run focus callback to workaround Android/Ti issue.
       	}
       },
       close: function(params) {
       	var self = this;
       
       	if (Ti.Platform.name == "android") {
       		self.blur(); // run blur callback to workaround Android/Ti issue.
       	}
       
       	self.win.close(params);
       }
       
    Note that these functions are members of a map/object, which is why their syntax is sort of weird.
  2. Junaid Younus 2012-08-20

    No runnable test code and link doesn't work, ticket marked as invalid.
  3. Lee Morris 2017-03-22

    Closing ticket as invalid with reference to the above comments.

JSON Source