Android Question Artifacts appear behind rounded corners

doncx

Active Member
Licensed User
Longtime User
I've attached sample code of a large keypad that displays a modal error dialog when a number entered is out of range. It works fine.

However, this *exact* same code (keypad.bas and message.bas) has an annoying problem when included in my larger app: When the error dialog is encountered and then cleared, artifacts from it appear behind the rounded corners of labels and buttons on the keypad. These artifacts only appear after another button is tapped.

For instance, a too-large number is entered and the error dialog comes up. You tap "Ok". Then, you tap the 'clear' button to remove a character from the number. This is when the artifacts appear.

For the life of me, I can't figure it out. I'd appreciate any ideas! Again, the attached example works, but the same code in my app has troubles. This despite the keypad being it's own activity.

Thanks
 

Attachments

  • keypad.zip
    12.6 KB · Views: 236
  • keypad problem.jpg
    keypad problem.jpg
    42.6 KB · Views: 213

doncx

Active Member
Licensed User
Longtime User
Thanks for your promising reply, Margret. I'm sorry to say however, the symptoms are the same after changing the activity alpha to zero.
 

Attachments

  • keypad.jpg
    keypad.jpg
    161.6 KB · Views: 239
Upvote 0

doncx

Active Member
Licensed User
Longtime User
Thanks for your assistance. You are right that I did not change the uploaded layout. However, that layout did not demonstrate the problem anyway. I did change the alpha of my application that was demonstrating the problem and it did not change it.
 
Upvote 0

doncx

Active Member
Licensed User
Longtime User
Have you run the one I attached? And is it working? If it still is showing the problem, what device are you testing on and what version of Android does it run?
I copied in your modified keypad.bal and the problem persists. Also, I've tried it on both a Google Nexus 10 tablet (4.2.2) and an Asus Transformer Infinity tablet (4.2.1). Both exhibit the problem.

I'm grateful for your suggestion but am still casting about for a solution. Got any more ideas?
 
Upvote 0

doncx

Active Member
Licensed User
Longtime User
Does it show if you comment this line:
B4X:
Activity.AddView(MessageDialog.AsView,0,0,100%x,100%y)
That disables the Error Dialog from appearing at all. Causes hanging later when keypad.bal attempts to display the dialog with MessageDialog.Show("Range Error", Main.strKeyPadTitle & " must be from " & Main.intKeyPadMin & " to " & Main.intKeyPadMax & " ", "Ok", "", "", 0, 0, 1.0 )

The debugger doesn't pick up the error, things just hang and then the app closes.
 
Upvote 0

doncx

Active Member
Licensed User
Longtime User
That disables the Error Dialog from appearing at all. Causes hanging later when keypad.bal attempts to display the dialog with MessageDialog.Show("Range Error", Main.strKeyPadTitle & " must be from " & Main.intKeyPadMin & " to " & Main.intKeyPadMax & " ", "Ok", "", "", 0, 0, 1.0 )

The debugger doesn't pick up the error, things just hang and then the app closes.

I've tried a lot of things: Panels both in front and behind the rounded label, changing the dialog background color to black before hiding it, all kinds of workarounds that would seem promising, but none have changed a thing. Getting rid of the round corners does it, but they are used throughout the app without issues elsewhere.
 
Upvote 0

doncx

Active Member
Licensed User
Longtime User
Don't use the same GradientDrawable for all buttons. Create a new one inside the loop.
Thanks for the idea, Erel. I have changed the GradientDrawable code so that each button has it's own GD.

Unfortunately, the problem persists. I can't figure out why the problem does not exist in the sample code I uploaded, but does in my more extensive app. What in the environment might affect this?
 
Upvote 0

doncx

Active Member
Licensed User
Longtime User
I fixed it this morning. Even though I'd tried a small black panel behind the rounded label and also a transparent panel in front, those hadn't fixed the problem.

Today, I put a 100%x by 100%y alpha 255 panel behind the whole keypad activity and that solved it.

Still a mystery why it happened in my app and not the test harness, but I'll accept the fix without further inquiry.

Thanks Erel and Margret for your assistance.
 
Upvote 0
Top