title: How to change the text field value from fragment to button click event
body: <p>Click on the button event.</p>
  <pre><code>public void onClick(View view) {
          Button result = view.findViewById(view.getId());
          textNo[R.id.t1].setText(&quot;2&quot;);
          Toast.makeText(getActivity(),&quot;클릭 : &quot; + result.getText().toString(),Toast.LENGTH_SHORT).show();
      }
  </code></pre>
  <p>For example, is there a way to change the value of the first text view by clicking the first button?
  There are countless buttons, so I gave resource id to each button and text
  Now, for example, only 5 buttons and text views are given.</p>
  <pre><code>for (i = 0; i &lt; 5; i++) {
              String textId = &quot;t&quot; + (i + 1);
              String buttonId = &quot;b&quot; + (i + 1);
              textNo[i] = view.findViewById(getResources().getIdentifier(textId, &quot;id&quot;, getActivity().getPackageName()));
              buttonNo[i] = view.findViewById(getResources().getIdentifier(buttonId, &quot;id&quot;, getActivity().getPackageName()));
  </code></pre>
  <p>When I press the button on the same line, I want to increase the number of text views located on it, but I kept trying, but I couldn't figure out how to do it in the fragment.
  <a href="https://i.stack.imgur.com/6pl5y.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>The outline of the XML code is as follows.</p>
  <pre><code>&lt;TextView
              android:id=&quot;@+id/t1&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;50dp&quot;
              android:layout_weight=&quot;1&quot;
              android:gravity=&quot;center&quot;
              android:text=&quot;@string/zero&quot; /&gt;
  </code></pre>
  <pre><code>&lt;Button
              android:id=&quot;@+id/b1&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:background=&quot;@drawable/button&quot;
              android:layout_weight=&quot;1&quot;
              android:text=&quot;@string/Click&quot;
              style=&quot;?android:attr/buttonBarButtonStyle&quot; /&gt;
  </code></pre>
  <p>It's my first time asking this question, so I'm very inexperienced, but if you tell me, I'll try harder.
  I'm sorry that I'm not good at English.</p>