I have defined a layer-list with a couple of items on an xml file. The items are displayed o.k. I want every five second or so one of the layers to become invisible.
It works o.k. for a simple textview for example but not for the Layer inside the LayerDrawable
final private Runnable runnable = new Runnable() {
public void run() {
LayerDrawable myDrawable= (LayerDrawable)getResources().getDrawable(R.drawable.all_layers);
Drawable layer = myDrawable.findDrawableByLayerId(R.id.interesting_layer);
if (layer.isVisible()==true)
{
layer.setVisible(false, false);
}
else
{
layer.setVisible(true, false);
}
TextView txt = (TextView) findViewById(R.id.txtTest);
if (txt.getVisibility()==0)
{
txt.setVisibility(4);
}
else
{
txt.setVisibility(0);
}
handler.postDelayed(this, 5000);
}
};
Do I try to get the Id of the layer in a wrong way (I found it from here...)? Thanks in advance!