Im hiding a button from within a handler (This is after i have made it Visible in another state of the app). The handler receives a message from a running thread and then updates the GUI.
The problem is that nearby (not all) buttons and textviews are also dissappearing from the screen.. Im using Relative Layout.
Layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget54"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/btnFold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="Fold"
android:visibility="invisible"/ >
<Button
android:id="@+id/btnRaise"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/btnFold"
android:text="Raise"
android:visibility="invisible"/>
<Button
android:id="@+id/btnCall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/btnRaise"
android:text="Call"
android:visibility="invisible" />
<TextView
android:id="@+id/txtFlopTurnRiver"
android:layout_width="135dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text=" " />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/btnCall"
android:layout_toLeftOf="@+id/btnCall"
android:text="Chip amount:" />
<TextView
android:id="@+id/txtHand1"
android:layout_width="73dp"
android:layout_height="wrap_content"
android:layout_above="@+id/textView1"
android:layout_centerHorizontal="true"
android:text=" " />
<Button
android:id="@+id/btnDeal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="@string/deal_deck"
android:visibility="invisible" />
<Button
android:id="@+id/btnRiver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/btnDeal"
android:text="River"
android:visibility="invisible" />
<TextView
android:id="@+id/txtHand2"
android:layout_width="73dp"
android:layout_height="wrap_content"
android:layout_above="@+id/txtHand1"
android:layout_toLeftOf="@+id/btnRaise"
android:text=" " />
<TextView
android:id="@+id/txtHand3"
android:layout_width="73dp"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/btnRaise"
android:layout_centerVertical="true"
android:text=" " />
<TextView
android:id="@+id/txtHand8"
android:layout_width="73dp"
android:layout_height="wrap_content"
android:layout_above="@+id/txtHand1"
android:layout_alignLeft="@+id/btnRiver"
android:text=" " />
<TextView
android:id="@+id/txtHand6"
android:layout_width="73dp"
android:layout_height="21dp"
android:layout_above="@+id/txtFlopTurnRiver"
android:layout_alignLeft="@+id/txtHand8"
android:layout_marginBottom="26dp"
android:text=" " />
<TextView
android:id="@+id/txtHand4"
android:layout_width="73dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/txtHand6"
android:layout_alignBottom="@+id/txtHand6"
android:layout_toLeftOf="@+id/btnRaise"
android:text=" " />
<TextView
android:id="@+id/txtHand5"
android:layout_width="73dp"
android:layout_height="wrap_content"
android:layout_above="@+id/txtHand4"
android:layout_alignLeft="@+id/txtHand1"
android:layout_marginBottom="14dp"
android:text=" " />
<TextView
android:id="@+id/txtHand7"
android:layout_width="73dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/txtHand3"
android:layout_alignBottom="@+id/txtHand3"
android:layout_alignRight="@+id/btnRiver"
android:layout_marginRight="26dp"
android:text=" " />
<TextView
android:id="@+id/txtChipAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_toLeftOf="@+id/btnCall"
android:layout_toRightOf="@+id/txtHand1"
android:text="103360" />
Does anyone know what could be causing the problem?
btnFold = (Button)findViewById(R.id.btnFold);
btnFold.setVisibility(View.GONE);