Strange problem on Honeycomb

Kevin

Well-Known Member
Licensed User
Longtime User
Strange problem on Honeycomb (BUG/GLITCH FOUND!)

I had a user request a refund today because he said that some views were overlaying other views. (That is kind of a mix of his words and mine).

Basically, my app has its normal layout with an extra panel that is normally invisible. When they click a button to do something, I load another layout into that panel then set the panel to be visible. When the user presses the back button, this panel gets hidden (visible = false). Basically I toggle the visibility on it in order to show or hide it.

This works on every AVD I have with a variety of APIs EXCEPT Honeycomb. I have tried it with 3.0 and 3.1 AVDs. It might work normally once or twice, but after a while, while the panel itself seems to go away, the views (buttons) that were loaded onto it stay on the screen but behind the views on its parent (the activity). These views that should not be there cannot be clicked on. Also, loading another full screen panel (a different function of the app) makes these ghost views disappear.

Another strange problem I noticed:
I have another layout that contains a full-screen partially transparent panel (alpha 200). This works similarly to the other one, except the panel and its views are all contained in a single layout. On every AVD I tested, this works fine. The "dimming panel" as I call it appears with a smaller panel with buttons on top of that. The dimming panel effectively dims the background, making it look very slick. :) Except on honeycomb, the panel seems to be there (I cannot click on stuff underneath it) but it is fully transparent. Even stranger is that the user can click a button on the top panel which hides that top panel and shows yet another panel (dimming panel is parent to both). When you do this, THEN the dimming panel appears slightly dim as it SHOULD and not transparent. :BangHead:

I just don't get it. These things work fine on everything but Honeycomb. Why? At this point, I don't know if the guy really had this problem and if so, is it going to happen to everyone or does he just have a dog of a tablet? I know that running things on the emulator often produces weird glitches like this, but I didn't think they should happen on a real device.

Any ideas?

B4X:
Activity.LoadLayout ("MyLayout")
PanelQS.SetLayout (0,0,100%x,100%y):PanelQS.Visible = False

PanelQS is contained in MyLayout and its parent is the activity.


This part loads another layout onto the full screen panel (PanelQS). It checks to see if it can set a property on txtSearch in order to see if it has been loaded. If not, it loads the layout into the panel. This other layout contains an EditText (txtSearch) and several buttons.

B4X:
Try ' Layout may already be loaded
    txtSearch.Visible = True
      Catch
        PanelQS.LoadLayout ("QuickSearch")
        Log ("Load QS layout onto PanelQS")
End Try



This part hides the panel. But on Honeycomb (AVD, and possibly for an actual user), the panel seems to hide but the other views loaded on it usually end up staying on the screen but behind the other views on the main activity.

B4X:
PanelQS.Visible = False


See my post below (#5). I believe I found a bug.
 
Last edited:

Kevin

Well-Known Member
Licensed User
Longtime User
Is it possible that maybe I have a z-order problem? Maybe I need to load the layouts in a different order, or move some panels to different parents?

I'm really at a loss. It's frustrating to have just spent a couple weeks of almost non stop work on this while trying to make it better (mostly dynamic layouts) only to have this bug pop up. I hadn't seen it before it was brought to my attention because the AVD I couldn't test on was Honeycomb. It just wouldn't start the AVD. So after this now, I created a new one in order to test it and have found several problems that never showed up at all on real devices or other AVDs.

Anyone ever have similar glitches on Honeycomb?
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
I used to use IsInitialized and changed it for some reason, though I don't remember why. :eek: I'll change that back, though I don't think that's the cause of this problem.

Having said that though, while I am only seeing this on Honeycomb, you are probably correct that it isn't a Honeycomb specific problem, but rather it is more likely that something isn't quite right in my code and it just happens to work okay on everything but Honeycomb.

I'll look into this some more and see what I can come up with. I appreciate the offer of testing it, and I may take you up on that if I can't make any progress.

Perhaps I just don't have the patience anymore. For years I was writing and selling Windows software to supplement my income when I had my previous job. About 5 years ago I got a new job that brought me much more money but also longer hours and more stress so I stopped programming because I didn't have the time anymore. Then I got an Android phone and gotten bitten by the programming bug again. Darn Google! :D
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
Apparently a bug or glitch...

After messing around with this for several hours, I accidentally stumbled on the cause of the problem. See attached project and be sure to run it on a Honeycomb AVD or device.

If a panel has a corner radius of 0 and you set its height & width to 100% through code, the views on the panel remain on screen after setting the panel's visible=false property.

Can be avoided by setting corner radius to 1 or more *OR* setting the height to 100%Y-1dip.

Now I just don't know how to fix it. Most of my layouts are adjusted in code now, so I need the 100%X and 100%Y for panels. If I remove 1 dip, you can see the bottom line of the screen beneath the panel. Same goes for a radius of 1 but it is less obvious (only in corners).


Bonus question: If I call LoadLayout("whatever") even if it has already been loaded, are there any ill side effects, other than possibly causing a slight delay? I am guessing that if they have the same name & are the same view type, there is no harm. Reason why I ask is because I was having an issue where a panel view was supposedly initialized but yet just setting it to visible wasn't showing the child views on it. So I changed it to just LoadLayout everytime it is called (load the child views onto the panel everytime). Although I haven't tested it further, maybe it was related to the problem in this post.
 

Attachments

  • HoneycombPanelTest.zip
    6.7 KB · Views: 225
Last edited:
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I'm not qualified to answer this but there are only two things I can suggest.
1/ Try Panel.Invalidate and see if that refreshes the panel even though it is not visible. Or Try activity.invalidate
2/ Put all the views from the panel, into an array or list and set them all to visible = false. I know its a long workaround, but if it works it works.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
I tried the invalidate thing on both but it didn't work. I'm also not sure that just setting the corner radius to 1 works either as I just did that in my app and still had the problem, so I used 100%y-1 (instead of -1dip). It seems to still fix it and on a Honeycomb tablet, -1 doesn't seem too obvious.

Still a bug in either B4A or Android 3.x, I believe.

EDIT:
I haven't had time for thorough testing, but it seems like this glitch may not happen if the panel is set to visible in the designer, but I'm not sure. Funny thing is that I have other panels in my app that are 100%y and do not have this problem. The way it is in the attached project above though, it does happen.
 
Last edited:
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
As a workaround, I'm now setting the full width bottom label of the activity to invisible while showing the panel that causes this problem. It works, but it is a half baked workaround. At least this way I can set the panel height to 100%y-1 without seeing the line at the bottom.

Following my recent streak of "if it isn't one thing, it's another", I somehow managed to fix the dimming panel problem on Honeycomb by playing with what was set to visible in the designer, but now I found out that the problem is happening on ICS.

Maybe I just missed these glitches before, but I'm beginning to wonder if these problems didn't start with the last B4A update? Perhaps I'll install the previous version and try, but I don't know if the project would be backward compatible.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Bonus question: If I call LoadLayout("whatever") even if it has already been loaded, are there any ill side effects, other than possibly causing a slight delay? I am guessing that if they have the same name & are the same view type, there is no harm. Reason why I ask is because I was having an issue where a panel view was supposedly initialized but yet just setting it to visible wasn't showing the child views on it. So I changed it to just LoadLayout everytime it is called (load the child views onto the panel everytime). Although I haven't tested it further, maybe it was related to the problem in this post.

I don't recommend you to reload a layout. It will create a new set of views and you will not have references (variables that point) to the old views which will still exist.

About the Honeycomb issue.
I see it too. This is most likely an issue with Honeycomb OS. It doesn't happen with other versions.
Hiding a Panel is a pretty straightforward operation. It is handled by the OS not Basic4android.

You can use the following workaround:
B4X:
Sub Button4_Click
   Panel1.Visible = False
   DoEvents
   Activity.Invalidate
   DoEvents
End Sub
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
Thanks for looking into this!

I'll see about not loading the layouts again. I was having problems with panels not showing again when setting it to visible and that seemed to fix the problem. Perhaps it was another side effect of this panel hiding problem in Honeycomb and I didn't realize it at the time.

I was able to fix the small demo project I made using Invalidate as you and thedesolatesoul suggested. I tried this in my actual app yesterday but it didn't work. Perhaps I missed a DoEvents or something. I will try again later when I have some time.

One thing I noticed is that in the sample project on Honeycomb, while it does hide now, it is kind of like a transition. The panel contents can still be seen for a moment after the original activity contents appears. Is this just on the slow emulator, or will it just look like this on a real Honeycomb device? There's nothing I can do about it, and at least I have a work-around now, but I am just curious.
 
Upvote 0
Top