I have created two tables, one on the left side and one in the center of the screen. When you start the application the table on the left is set to visible and the table in the center is set to invisible.
Now I want to click a button in the left table (Buton_left) and the entire table in the center would become visible.
I have this method so far but it doesn't seem to be working. Any help or suggestion would be appreciated. Let me know if you need any more information.
package com.example.musicapp;
import android.os.Bundle;
public class Tbl_Show_Hide extends Activity implements OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TableLayout table_left = (TableLayout)findViewById(R.id.table_left);
TableLayout table_center = (TableLayout)findViewById(R.id.table_center);
Button Buton_left = (Button)findViewById(R.id.Buton_left);
table_left.setOnClickListener(this);
table_center.setOnClickListener(this);
Buton_left.setOnClickListener(this);
}
@Override
public void onClick(View v) {
boolean visible = true;
int targetId = v.getId();
if(targetId == R.id.Buton_left)
{
if(visible)
{
if(table_center.getVisibility() == View.INVISIBLE)
{
table_center.setVisibility(View.VISIBLE);
}
}
}
}