title: How to getText of button
body: <p>I have an array of buttons. Now, when each button is clicked, I want the text of buttons to be displayed in the textBox. I tried it but its not working. Here's my code:</p>
  
  <pre><code>public boolean initDay()
      {
          LinearLayout layoutVertical = (LinearLayout) findViewById(R.id.liVLayout);
          LinearLayout rowLayout=null;
  
          LayoutParams param = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT,1);
  
          for (i = 0; i&lt;6; i++) 
          {
              rowLayout = new LinearLayout(this);
              rowLayout.setWeightSum(7);
              layoutVertical.addView(rowLayout,param);
              for(j=0;j&lt;7;j++)
              {
                  pBtnDay[i][j]=new Button(this);
                  rowLayout.addView(pBtnDay[i][j],param);
                  pBtnDay[i][j].setClickable(true);
                  pBtnDay[i][j].setOnClickListener(this);
              }
          }
          return true;
      }
      public void onClick(View v)
      {
           TextView t = (TextView)findViewById(R.id.textV);   
           t.setText(pBtnDay[i][j].getText());
      }
  </code></pre>