I am trying to enable and disable 4 UI buttons programmatically. And I am using Unity3D, but I can't seem to make it work. What am I missing? My current attempt looks like this:
My LinearLayout xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/overlay"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:gravity="right"
   android:orientation="vertical" >
    <com.BoostAR.Generic.TintedImageButton
       android:id="@+id/helpButton"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_margin="@dimen/overlayButtonMargin"
       android:src="@drawable/help"
       android:visibility="visible" />
    <com.BoostAR.Generic.TintedImageButton
       android:id="@+id/refreshButton"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_margin="@dimen/overlayButtonMargin"
       android:src="@drawable/refresh" />
    <com.BoostAR.Generic.TintedImageButton
       android:id="@+id/screenshotButton"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_margin="@dimen/overlayButtonMargin"
       android:src="@drawable/photo" />
    <com.BoostAR.Generic.LockButton
       android:id="@+id/lockButton"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_margin="@dimen/overlayButtonMargin"
       android:src="@drawable/unlocked" />     
</LinearLayout>
What I did in the code:
private static final int[] AUGMENTED_UI_IDS = {
        R.id.refreshButton, R.id.screenshotButton, R.id.lockButton
};
private void updateAugmentedUiVisibility() 
{
    final int visibility =
                (mShouldShowAugmentedUI ? View.VISIBLE : View.INVISIBLE);
    runOnUiThread(new Runnable() {
            @Override
            public void run() {
                for (int id : AUGMENTED_UI_IDS) {
                    final View view = findViewById(id);
                    if (view == null) {
                        Log.e(LOG_TAG, "Failed to find view with ID: " + id);
                    } else {
                        Log.e(LOG_TAG, "Visibility: " + visibility);
                        view.setVisibility(visibility);
                    }
                }
            }
        });
    }
}
OUTCOME:
The statement
Log.e(LOG_TAG, "Failed to find view with ID: " + id);
gets called. When I did cross reference the id numbers which seem to be good.
 
    