Good morning, I'm new to Android programming and I'm trying to create a program that based on a subject that the user chooses, will open a certain screen, everything I did was based on search in websites, videos and etc; but when compiling the program and executing it, it hangs when I click the button to go to the menu (that of the print), and it simply closes. I thought the error could be in the search bar, but I used the same in two other screens and it worked, so I think the problem is in Scrool View. The idea would be for it to rotate vertically to display the other subjects and the search bar to remain static above. Thanks to anyone who can help:)
activitycode:
<android.support.v7.widget.Toolbarandroid:id="@+id/toolbar2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/blue" />
<EditText
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="55dp"
android:background="@color/blue"
android:ems="10"
android:inputType="text"
android:text="@string/textView"
android:labelFor="@id/toolbar2"
android:textColor="@color/black" />
<ImageButton
android:id="@+id/my_account"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignBottom="@+id/toolbar2"
android:layout_alignParentRight="true"
android:background="@color/blue"
android:scaleType="fitEnd"
app:srcCompat="@drawable/account"
android:clickable="true"
android:onClick="conta"/>
<ImageButton
android:id="@+id/search_user"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_marginEnd="22dp"
android:layout_marginTop="10dp"
android:layout_toStartOf="@+id/my_account"
android:background="@color/blue"
android:scaleType="fitEnd"
app:srcCompat="@drawable/magnify"
android:clickable="true"
android:onClick="obras"/>
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="@+id/imageButtonArte"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginLeft="10dp"
android:background="@color/transparente"
android:scaleType="fitXY"
app:srcCompat="@drawable/icone_arte"
android:clickable="true"
android:onClick="obras"/>
<ImageButton
android:id="@+id/imageButtonBiologia"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginStart="40dp"
android:background="@color/transparente"
android:scaleType="fitXY"
android:clickable="true"
app:srcCompat="@drawable/icone_biologia"
android:onClick="obras"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="@+id/imageButtonFilosofia"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:scaleType="fitXY"
android:background="@color/transparente"
android:clickable="true"
android:onClick="obras"
app:srcCompat="@drawable/icone_filosofia"/>
<ImageButton
android:id="@+id/imageButtonFisica"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginStart="40dp"
android:layout_marginTop="10dp"
android:background="@color/transparente"
android:scaleType="fitXY"
android:clickable="true"
android:onClick="obras"
app:srcCompat="@drawable/icone_fisica" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="@+id/imageButtonGeografia"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginLeft="10dp"
android:background="@color/transparente"
android:layout_marginTop="10dp"
android:scaleType="fitXY"
android:visibility="visible"
android:clickable="true"
android:onClick="obras"
app:srcCompat="@drawable/icone_geografia" />
<ImageButton
android:id="@+id/imageButtonHistoria"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginStart="40dp"
android:background="@color/transparente"
android:layout_marginTop="10dp"
android:scaleType="fitXY"
android:clickable="true"
android:onClick="obras"
app:srcCompat="@drawable/icone_historia" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="@+id/imageButtonMatematica"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginLeft="10dp"
android:background="@color/transparente"
android:layout_marginTop="10dp"
android:scaleType="fitXY"
android:clickable="true"
android:onClick="obras"
app:srcCompat="@drawable/icone_matematica" />
<ImageButton
android:id="@+id/imageButtonPortugues"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginStart="40dp"
android:background="@color/transparente"
android:layout_marginTop="10dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/icone_portugues"
android:clickable="true"
android:onClick="obras"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="@+id/imageButtonQuimica"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginLeft="10dp"
android:background="@color/transparente"
android:layout_marginTop="10dp"
android:scaleType="fitXY"
android:clickable="true"
android:onClick="obras"
app:srcCompat="@drawable/icone_quimica" />
<ImageButton
android:id="@+id/imageButtonSociologia"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginTop="10dp"
android:layout_marginStart="40dp"
android:background="@color/transparente"
android:scaleType="fitXY"
android:clickable="true"
android:onClick="obras"
app:srcCompat="@drawable/icone_sociologia" />
</LinearLayout>
</LinearLayout>
</ScrollView>