Last active
June 3, 2016 17:26
-
-
Save grantges/762d95bb3304501b46e7 to your computer and use it in GitHub Desktop.
Appcelerator Titanium - Window Override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This file would go under the app/lib directory | |
*/ | |
exports.createWindow = function(params){ | |
var win = Ti.UI.createWindow(params); | |
win.addEventListener("open", function(e){ | |
if(OS_ANDROID){ | |
var activity = Ti.Android.activity ? Ti.Android.activity : Ti.Android.currentActivity; | |
activity.onStart = | |
activity.onResume = | |
activity.onRestart = | |
activity.onPause = function(e){ | |
// DO SOMETHING | |
} | |
} | |
}); | |
win.addEventListener("close", function(e){ | |
if(OS_ANDROID){ | |
var activity = Ti.Android.activity ? Ti.Android.activity : Ti.Android.currentActivity; | |
activity.onStart = | |
activity.onResume = | |
activity.onRestart = | |
activity.onPause = null; | |
} | |
}); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Alloy> | |
<Window module="apphooks" backgroundColor="#fff"> | |
<Label>Hello World</Label> | |
</Window> | |
</Alloy> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment