Dialog on Screen Rotation on Android 4.3 - android-4.3-jelly-bean

I noticed a problem that seems to only occur on Android 4.3. I'm using a AlertDialog and I dismiss and show it in the onCreate function when an orientation change occurs by storing the dialog state in onSaveInstanceState().
On other versions of android (4.0.x, 4.1.x, 4.2.x, 2.3.x), this works perfectly fine. I can rotate the device multiple times and the dialog will never disappear but on Android 4.3, if I rotate the screen enough, the dialog will disappear but instantly reappear if I rotate the screen again. I noticed that everytime the dialog disappears I'd see a GL_INVALID_OPERATION error in Logcat.
I'm wondering if this is a known bug or if there are any work arounds.

After heavy testing, it appears that this is a timing glitch. I'm not too sure of what's going on in the background but I can guess from the behavior that some GL object are not ready when attempting to display the dialog cause the dialogs not to be drawn.
I found a workaround by just declaring a handler in the class and doing a post event to the handler to show the dialog. It seems to give the activity enough time to intialize everything and the problem no longer occurs.

Related

Tool bars are getting rearranged

I am using VC++ MFC and have the following toolbars in my software.
While working with different screens and software is minimized, if we disconnect the other screen, the toolbars get messed up after restoring the application.
Also that issue occurs, sometimes, when using single screen and change screen resolution or laptop lid is closed and re-open it, most of the cases when application is minimized at time we change anything.
We are not executing any code as such to draw the toolbars every time. While software is starting up, we read the toolbar positions from registry and create toolbars, and while closing application, we read the toolbar current position and save it back to registry.
Please suggest what should I do to fix this..
Thanks...
From the details what i can say is, while you were working on screen of one size the application considering the toolbar co-ordinates in relation to that screen. But when screen changes the old co-ordinates are no more valid as new screen may have different size and that's what causing the issue.

How can I make error dialog always stay on top

I am developing a JavaFX 2.2 application where background threads may trigger an error dialog to show until its close button is pressed.
If other background threads trigger message dialogs that are not as urgent as the error, these dialogs must not be placed on top of the error dialog.
In other words, I want an error dialog that blocks everything else, and that is never hidden by other popups, or by the main window.
I have tried setting modality to APPLICATION_MODAL for the error dialog, and WINDOW_MODAL for the other, lesser dialogs, but lesser dialogs still appear above the error dialog if they are triggered while the error dialog is showing.
I am not in a position where I can use Java 8, so DialogsFx and ControlFx and other libraries are out of the question.
In Swing, I used to use layers a log, like POPUP_LAYER, ALERT_LAYER, ERROR_LAYER, but I can't find anything similar in JavaFx.
Regards,
Fredrik
If your using an additional stage to show your dialogs you can use its method
stage.showAndWait();
which blocks any event till you close the stage again.
Hope that helps.

uiwebview preventing access to buttons on uitoolbar

Am I thick or what? I have a view controller, and within that there is a UIWebView. When I run the app, the WebView covers the UIToolbar at the bottom and the UIButtons there, and so you cannot navigate away from the WebView. I cannot figure out how to change the WebView size or behaviour.
Unfortunately I do not have sufficient rep to post screenshots. The WebView displays an html file with text. The WebView partially covers the status bar at the top and completely covers the taskbar at the bottom. I can touch and drag the view up to see the taskbar and buttons at the bottom, but cannot use them.
I am using storyboard to build the app, and have done similar apps before without issue (in iOS6) but iOS7 appears to have thrown me a curveball.
I cannot see how to change the size in Xcode - or should I be looking at the html code in the file that the WebView is calling?
Oddly enough this is no longer an issue, I have not made any changes to code or config, and the only thing different is I upgraded my version of X-Code

WinRT XAML - how to fix higlight issues?

When I'm testing my app on a mouse-driven device, I'm seeing a couple of odd highlight issues that I would like to try and resolve.
The first occurs when I call up the app bar, hover the mouse over a button (at which point the button goes grey) and then press Escape to dismiss the app bar. If I then call up the app bar again, the button has stayed grey, even if the mouse isn't over it, and remains in that state until I move the mouse over it and then away again.
I can't immediately see a property of the button that I can reset to clear that state when the app bar gets dismissed.
The other oddity I'm seeing is that sometimes the first item in the list on the page will get a box drawn around it:
This seems to happen when the app bar is being dismissed. I'm guessing that this is because the item is in a particular state that causes the box to appear but I'm not sure what state or how to clear it. The box does not appear during normal use of my app.
Thanks for any clarification or solutions you can provide.
I found a simple way to workaround this issue. In the code for Clicked/Tapped set Visibility of the button:
CreateNewDatabase.Visibility = Visibility.Collapsed;
CreateNewDatabase.Visibility = Visibility.Visible;
It will reset button state to Normal.
Hope this helps!
So, the issue is that the VisualState for the Button is being set to PointedOver, and then not being unset (because your mouse isn't leaving the bounds of the control and therefore triggering a PointerExited event). What this means is that you'll have to manually set the VisualState of the Button if you want it to change in this manner. You could do it on AppBar's Closed event. Basically, do a recursive check of all Children of the Content property of the AppBar using the VisualTreeHelper. Check to see if the Child is a Button. If it is, set its VisualState using VisualStateManager.GoToState().
I've also figured out what was causing the black box around the button - it is to indicate that the button has Focus.
The rather strange thing is that I'm not really sure why that specific button is getting focus or how a user is supposed to give focus to a button without it just randomly happening so, until I figure that out, I've decided to comment out the Focus state support from the Visual Manager XAML used in the default GridView item style.

blank screen after showing alert in j2me

I have developed a game but this is a serious problem I am facing. I don't have any threads in my code , but whenever I use alert
Display.setCurrent(my_alert)// my_alert has a timeout of 3000ms
then after this alert, a blank white screen appears.When the screen is pressed, then my game canvas reappears. Before setting alert, my game canvas of checkers board is set as the current display. This problems also appears after the automatic keypad lock.
This alert is vital for my game, Kindly suggest a solution.
Issues like that typically indicate missing or incorrect override of GameCanvas method showNotify():
The implementation calls showNotify() immediately prior to this Canvas being made visible on the display. Canvas subclasses may override this method to perform tasks before being shown, such as setting up animations, starting timers, etc. The default implementation of this method in class Canvas is empty.
Above method is invoked at return from Alert to prior screen. GameCanvas should somehow trigger repaint of the the screen (eg using repaint or flushGraphics methods), otherwise it will be displayed blank.
The fact that this problems also appears after the automatic keypad lock makes it even more likely that showNotify is not done right in your MIDlet.

Resources