Android Development Help: Buttons Flicker

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

Android Development Help: Buttons Flicker

Postby GTM » Sun Mar 11, 2012 7:22 am UTC

Not sure if this would be the right place to ask... but It's worth a shot cause it's driving me nuts.

I'm developing a app for Android and my buttons seem to be flickering. I'm using an overlay view for the buttons on top.

//button1.setVisibility(View.VISIBLE);

button2 = (Button) overlayView.findViewById(R.id.button2);
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//button1.setVisibility(View.VISIBLE);


button2 is always visible, indicated from the XML file. It does not flicker.

button1 is invisible from the XML file. If set in the first line does not flicker. It flickers if I set it on the second line and not the first.

I think it has something to do with views but I can't figure it out. The flickering buttons also disappear when there's a toast/alertDialog.

Help please! Appeciation!
GTM
 
Posts: 57
Joined: Tue Nov 10, 2009 4:53 am UTC

Re: Android Development Help: Buttons Flicker

Postby Yakk » Mon Mar 12, 2012 7:04 pm UTC

Use [ code ] blocks to make your code easier to read.

In the first case, you are setting the visibility of the button .. where?
In the second case, you are setting it on the button2 onclick handler?

What do you mean by "it flickers"? You aren't being clear. Is it partially visible? Appears and disappears when you do some action? Does so constantly, as if in a loop? Is blocked by button2? What else is on/near button1?

In order to have a hope of getting support on something like this, you first have to approach it as a bug. That means you really need to be specific about what you are doing, and what your terms mean. Ideally, you'll want screenshots. You'll also want to reduce your problem to a minimal set of code that completely describes what is going wrong -- create an android app that contains nothing but the two buttons, and generates the flicker effect you are talking about. (Of course, in doing so, you might work out what code is causing the flicker problem).
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
 
Posts: 10035
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Android Development Help: Buttons Flicker

Postby GTM » Wed Mar 14, 2012 11:12 pm UTC

Turns out this happens with some sample code that we're working with, which is more simplified code as you have said, so we went on to ask on the forums there and they said it was a new bug.

By flickering we mean the buttons shows up but it goes invisible for a split second a couple of times a second. It seems to only happen on some devices and not others (doesnt happen on HTC Wildfire, happens on ASUS Transformer).

To work around it, we kept the buttons always visible (since the buttons that started out visible didnt flicker), but dulled out the buttons/disabled them when we wanted them invisible before.

Will keep your tips in mind next time we ask for help! Thanks!
GTM
 
Posts: 57
Joined: Tue Nov 10, 2009 4:53 am UTC


Return to Coding

Who is online

Users browsing this forum: >-) and 9 guests