title: problem in coding for layout in android studio
body: <p>I made one layout in android studio and made a java class (form_view.java) to code it but it is not working.</p>
  
  <p>Here is my java code (form_view.java)</p>
  
  <pre><code>public form_view(Activity activity,  int Layoutid){
      this.activity=activity;
      LayoutFormInfo = activity.&lt;LinearLayout&gt;findViewById(R.id.Layoutid);
      init();
  }
  
  private void init() {
          e1=LayoutFormInfo.findViewById(R.id.editText);
          e2=LayoutFormInfo.findViewById(R.id.editText2);
          e3=LayoutFormInfo.findViewById(R.id.editText3);
          b1=LayoutFormInfo.findViewById(R.id.button);
          ch1=LayoutFormInfo.findViewById(R.id.checkBox);
          b1.setOnClickListener(this);
          e3.setText("hello");
      }
  
      @Override
      public void onClick(View v) {
          if(v.getId()== R.id.button){
              Toast.makeText(activity, "21+ only, keep out", Toast.LENGTH_SHORT).show();
  
          }
      }
  }
  </code></pre>
  
  <p>and I include my layout by this code in main activity</p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:app="http://schemas.android.com/apk/res-auto"
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       tools:context=".MainActivity"&gt;
  
       &lt;LinearLayout
           android:id="@+id/yes"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:orientation="horizontal"
           tools:layout_editor_absoluteX="54dp"
           tools:layout_editor_absoluteY="44dp"/&gt;
       &lt;include layout="@layout/ayoutid"
           /&gt;
       &lt;include layout="@layout/ayoutid"
           android:id="@+id/Layoutid"/&gt;
  
   &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>