Skip to content

Instantly share code, notes, and snippets.

@MotiurRahman
Last active December 31, 2015 00:39
Show Gist options
  • Save MotiurRahman/7908987 to your computer and use it in GitHub Desktop.
Save MotiurRahman/7908987 to your computer and use it in GitHub Desktop.
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40931b58
/*Hi I have tested this jira ticket. It's a bug. When I use "Titanium.Android.currentActivity.finish(); this method in any
Click event its crash or full exit from the application
Testing Environment:
Titanium SDK: 3.1.3
Android SDK: 4.2.2
Steps to Reproduce:
1. Create a simple project.
2. Paste this code in app.js file
3. Run this with testing environment.
*/
//if you run this code application will crash
//Test Case 1
var win = Ti.UI.createWindow({
navBarHidden : false,
title : 'First Window',
backgroundColor : '#000',
layout : 'vertical',
exitOnClose : true
});
// Create a Button.
var btn = Ti.UI.createButton({
title : 'Test Button',
height : Ti.UI.SIZE,
width : Ti.UI.SIZE,
top : 10,
});
var win2 = Ti.UI.createWindow({
navBarHidden : false,
title : 'Second Window',
backgroundColor : 'red',
});
// Listen for click events.
btn.addEventListener('click', function() {
Titanium.Android.currentActivity.finish();
win2.open();
});
// Add to the parent view.
win.add(btn);
win.open();
//If you run this code full exit from the application.
// Test Case 2
var win = Ti.UI.createWindow({
title:'test'
});
win.backgroundColor = 'white';
var b1 = Ti.UI.createButton({
title : 'Open Window',
height : 'auto',
width : 'auto'
});
// Here is an example of creating the menu handlers in the window creation options.
b1.addEventListener('click', function(e) {
var w = Ti.UI.createWindow({
title: 'New Window',
backgroundColor : 'blue',
navBarHidden : false,
activity : {
onCreateOptionsMenu : function(e) {
var menu = e.menu;
var m1 = menu.add({ title : 'Close Window' });
m1.setIcon(Titanium.Android.R.drawable.ic_menu_close_clear_cancel);
m1.addEventListener('click', function(e) {
Titanium.Android.currentActivity.finish();
});
}
}
});
var l = Ti.UI.createLabel({
backgroundColor : 'white', color : 'black',
width : 'auto', height : 'auto',
text : 'Press the menu button, then select Close Window. You should see a graphic w/ the menu text.'
});
w.add(l);
w.open({ animated : true});
});
win.add(b1);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment