title: How to change textview background without change other textview background
body: <p>Need help for my coding. I trying make warehouse app, in this app user can input, control, and take out item from warehouse with this app. For input data, user must input some data like name, rack for storing item, quantity, and vendor. There a little problem in this feature, for choose rack, i use dialog box for display empty rack. When user click empty rack, choosen rack will change the color and if user choose other rack, first rack will back to old colour like this<a href="https://i.stack.imgur.com/oh41n.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oh41n.gif" alt="" /></a></p>
  <p>but in my app, rack can't back to old color. Here my app
  <a href="https://i.stack.imgur.com/YdN9h.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YdN9h.gif" alt="enter image description here" /></a></p>
  <p>I have try read some article which similar like <a href="https://stackoverflow.com/questions/46418865/android-change-background-color-when-clicked">this</a> but that require me for set all background manually which it will change all background include rack &quot;Terisi&quot;. Is there any way for solving this problem ?</p>
  <p>Here my code</p>
  <pre><code>TextView L4A1,L4A2,L4A3,L4A4;
  TextView L4B1,L4B2,L4B3,L4B4;
  TextView L4C1,L4C2,L4C3,L4C4;
  TextView L4D1,L4D2,L4D3,L4D4;
  TextView L4E1,L4E2,L4E3,L4E4;
  TextView L4F1,L4F2,L4F3,L4F4;
  String SL4A1,SL4A2,SL4A3,SL4A4;
  String SL4B1,SL4B2,SL4B3,SL4B4;
  String SL4C1,SL4C2,SL4C3,SL4C4;
  String SL4D1,SL4D2,SL4D3,SL4D4;
  String SL4E1,SL4E2,SL4E3,SL4E4;
  String SL4F1,SL4F2,SL4F3,SL4F4;
  String rack;
  
   private void PopupFourOpen() {
      Dialog dialog = new Dialog(AdminInputStockInActivity.this);
      dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
      dialog.setContentView(R.layout.activity_admin_popup_tracking4);
      Objects.requireNonNull(dialog.getWindow());
      dialog.setCancelable(true);
      dialog.setCanceledOnTouchOutside(false);
      WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
      lp.copyFrom(Objects.requireNonNull(dialog.getWindow()).getAttributes());
      lp.width = WindowManager.LayoutParams.MATCH_PARENT;
      lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
      dialog.getWindow().setAttributes(lp);
      dialog.show();
  
    
      L4A1 =dialog.findViewById(R.id.AdminPopupTracking_L4A1);
      L4A2 =dialog.findViewById(R.id.AdminPopupTracking_L4A2);
      L4A3 =dialog.findViewById(R.id.AdminPopupTracking_L4A3);
      L4A4 =dialog.findViewById(R.id.AdminPopupTracking_L4A4);
      
      L4B1 =dialog.findViewById(R.id.AdminPopupTracking_L4B1);
      L4B2 =dialog.findViewById(R.id.AdminPopupTracking_L4B2);
      L4B3 =dialog.findViewById(R.id.AdminPopupTracking_L4B3);
      L4B4 =dialog.findViewById(R.id.AdminPopupTracking_L4B4);
     
      L4C1 =dialog.findViewById(R.id.AdminPopupTracking_L4C1);
      L4C2 =dialog.findViewById(R.id.AdminPopupTracking_L4C2);
      L4C3 =dialog.findViewById(R.id.AdminPopupTracking_L4C3);
      L4C4 =dialog.findViewById(R.id.AdminPopupTracking_L4C4);
     
      L4D1 =dialog.findViewById(R.id.AdminPopupTracking_L4D1);
      L4D2 =dialog.findViewById(R.id.AdminPopupTracking_L4D2);
      L4D3 =dialog.findViewById(R.id.AdminPopupTracking_L4D3);
      L4D4 =dialog.findViewById(R.id.AdminPopupTracking_L4D4);
     
      L4E1 =dialog.findViewById(R.id.AdminPopupTracking_L4E1);
      L4E2 =dialog.findViewById(R.id.AdminPopupTracking_L4E2);
      L4E3 =dialog.findViewById(R.id.AdminPopupTracking_L4E3);
      L4E4 =dialog.findViewById(R.id.AdminPopupTracking_L4E4);
      
      L4F1 =dialog.findViewById(R.id.AdminPopupTracking_L4F1);
      L4F2 =dialog.findViewById(R.id.AdminPopupTracking_L4F2);
      L4F3 =dialog.findViewById(R.id.AdminPopupTracking_L4F3);
      L4F4 =dialog.findViewById(R.id.AdminPopupTracking_L4F4);
      
  
      readData4();
  
      ImageView btnBack = dialog.findViewById(R.id.btn_back_AdminPopupTracking4);
      ImageView btnKiri = dialog.findViewById(R.id.btn_kiri_AdminPopupTracking4);
      ImageView btnKanan = dialog.findViewById(R.id.btn_kanan_AdminPopupTracking4);
      Button tambah = dialog.findViewById(R.id.btn_tambah_popup_tracking4);
      tambah.setEnabled(false);
  
      btnBack.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              dialog.dismiss();
          }
      });
      btnKiri.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              PopupThreeOpen();
              dialog.dismiss();
          }
      });
      btnKanan.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              PopupFiveOpen();
              dialog.dismiss();
          }
      });
      tambah.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              inputItemRack_.setText(rack);
              dialog.dismiss();
          }
      });
  
      L4A1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4A2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4A3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4A4.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
      
     
  
      L4B1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4B2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4B3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4B4.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      
  
      L4C1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4C2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4C3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4C4.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
     
  
      L4D1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4D2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4D3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4D4.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
     
  
      L4E1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4E2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4E3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4E4.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      
  
      L4F1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4F2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4F3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      L4F4.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              tambahRack4(view);
              tambah.setEnabled(true);
          }
      });
  
      
  }
  
  public void tambahRack4(View view) {
      //BARIS A
      SL4A1 = L4A1.getText().toString();
      SL4A2 = L4A2.getText().toString();
      SL4A3 = L4A3.getText().toString();
      SL4A4 = L4A4.getText().toString();
     
      //BARIS B
      SL4B1 = L4B1.getText().toString();
      SL4B2 = L4B2.getText().toString();
      SL4B3 = L4B3.getText().toString();
      SL4B4 = L4B4.getText().toString();
     
      //BARIS C
      SL4C1 = L4C1.getText().toString();
      SL4C2 = L4C2.getText().toString();
      SL4C3 = L4C3.getText().toString();
      SL4C4 = L4C4.getText().toString();
     
      //BARIS D
      SL4D1 = L4D1.getText().toString();
      SL4D2 = L4D2.getText().toString();
      SL4D3 = L4D3.getText().toString();
      SL4D4 = L4D4.getText().toString();
      
      //BARIS E
      SL4E1 = L4E1.getText().toString();
      SL4E2 = L4E2.getText().toString();
      SL4E3 = L4E3.getText().toString();
      SL4E4 = L4E4.getText().toString();
      
      //BARIS F
      SL4F1 = L4F1.getText().toString();
      SL4F2 = L4F2.getText().toString();
      SL4F3 = L4F3.getText().toString();
      SL4F4 = L4F4.getText().toString();
      
  
  
      switch (view.getId()){
          case R.id.AdminPopupTracking_L4A1: rack = SL4A1;
          L4A1.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4A2: rack = SL4A2;
          L4A2.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4A3: rack = SL4A3;
          L4A3.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4A4: rack = SL4A4;
          L4A4.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          
  
          case R.id.AdminPopupTracking_L4B1: rack = SL4B1;
          L4B1.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4B2: rack = SL4B2;
          L4B2.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4B3: rack = SL4B3;
          L4B3.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4B4: rack = SL4B4;
          L4B4.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          
  
          case R.id.AdminPopupTracking_L4C1: rack = SL4C1;
          L4C1.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4C2: rack = SL4C2;
          L4C2.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4C3: rack = SL4C3;
          L4C3.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4C4: rack = SL4C4;
          L4C4.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          
  
          case R.id.AdminPopupTracking_L4D1: rack = SL4D1;
          L4D1.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4D2: rack = SL4D2;
          L4D2.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4D3: rack = SL4D3;
          L4D3.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4D4: rack = SL4D4;
          L4D4.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          
          case R.id.AdminPopupTracking_L4E1: rack = SL4E1;
          L4E1.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4E2: rack = SL4E2;
          L4E2.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4E3: rack = SL4E3;
          L4E3.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4E4: rack = SL4E4;
          L4E4.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          
  
          case R.id.AdminPopupTracking_L4F1: rack = SL4F1;
          L4F1.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4F2: rack = SL4F2;
          L4F2.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4F3: rack = SL4F3;
          L4F3.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
          case R.id.AdminPopupTracking_L4F4: rack = SL4F4;
          L4F4.setBackground(getResources().getDrawable(R.drawable.kotak_biru_muda));break;
  
      }
  
  }
  </code></pre>