I'm making a program that change the color of the background, for example, when I press white, change background to white, black to black, and so on... and after have pressed a button the others disappear and I have already done that but what I want to do is that each tap on the Textview the buttons appear/disappear. how can I do this? 

this is my code

```
LinearLayout myLayout;
    LinearLayout myLayout2;
    // Declare UI elements
    private Button firstButton;
    private Button secondButton, thirdButton;
//    private ImageView changeBackground;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); 

        myLayout = (LinearLayout) findViewById(R.id.myLayout);
        myLayout2 = (LinearLayout) findViewById(R.id.myLayout2);

        // Initialize the UI components

        firstButton = (Button) findViewById(R.id.button1); 
        // When we creating a button and if we expect that to use for event handling we have to set the listener
        firstButton.setOnClickListener(this);
        secondButton = (Button) findViewById(R.id.button2);
        secondButton.setOnClickListener(this);
        thirdButton = (Button) findViewById(R.id.button3);
        thirdButton.setOnClickListener(this);

    }

@Override
    public void onClick(View v) { // Parameter v stands for the view that was clicked.  

        switch(v.getId()) {

        case R.id.button1:
            myLayout.setBackgroundColor(Color.WHITE);
            myLayout2.setVisibility(View.INVISIBLE);
            break;

        case R.id.button2:
            myLayout.setBackgroundColor(Color.BLACK);
            myLayout2.setVisibility(View.INVISIBLE);
            break;

        case R.id.button3:
            myLayout.setBackgroundColor(Color.RED);
            myLayout2.setVisibility(View.INVISIBLE);
            break;

        }

    }

```

the xml

```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#A9F5F2"
    android:id="@+id/myLayout"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/hello_world" />

        <LinearLayout
             android:id="@+id/myLayout2"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:background="#D8D8D8"
             android:orientation="horizontal"
             android:gravity="center"
             tools:context=".MainActivity" >

            <Button
                android:id="@+id/button1"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"        
                android:text="@string/white" />

            <Button
                android:id="@+id/button2"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/button1"
                android:layout_alignBottom="@+id/button1"
                android:layout_toRightOf="@+id/button1"
                android:text="@string/black" />

            <Button
                android:id="@+id/button3"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/button2"
                android:layout_alignBottom="@+id/button2"
                android:layout_toRightOf="@+id/button2"
                android:text="@string/red" />
        </LinearLayout>
</LinearLayout>

```
['https://Stackoverflow.com/questions/20247923', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2958480/']
the problem was that i was calling a function (one click) and then nothing triggered. I change the code and now it's working super! here you can check it out: 

<http://bootply.com/97366>

View:

Is the same that in my question, but only changed the modal name to "myModal".

Js File:

```
$('#myModal').on('show', function() {
 var id = $(this).data('id'),
 username = $(this).data('usern');

 $('#myModal .modal-body p').html("Desea eliminar al usuario " + '<b>' + username + '</b>' + ' ?');
})

$('.confirm-delete').on('click', function(e) {
  e.preventDefault();

  var id = $(this).data('id');
  var user = $(this).data('title');

  $('#myModal').data('id', id).modal('show');
  $('#myModal').data('usern', user).modal('show');
});

$('#btnYes').click(function() {
var id = $('#myModal').data('id');

$.ajax({
  url: 'deleteFrontUser',
  type: 'POST',
  data: 'id='+id,
  success: function(html){

    $('[data-id='+id+']').parents('tr').remove();
    $('#myModal').modal('hide');
  }      
});
return false;
});

```

What i also did, was to add "data-title" atribute in the html, like this:

```
<td><a href="#" class="confirm-delete btn mini red-stripe" role="button" data-title="{$frontuser->username}" data-id="{$frontuser->id}">Eliminar {$frontuser->id} {$frontuser->username} </a></td>

```

data-title stores the username so jquery can sustract it later. Please notice that i'm using smarty template engine.

Hope this can help newbies like me :)
Try saving the id you pass there (I suppose it's the id of the user in the list) to a global variable which will be always overridden with the last id of the corresponding row where you pressed the delete button.

and then you can just call the modal like this:

```
 $('#myModal3').modal('show');

```

After this you can get the id from the global variable and pass it to the ajax post