Trying to change a layout from an ImageButton but when i run it on my phone it does not switch instead it says program has stopped.
Java;
public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ImageButton ImageButton = (ImageButton) findViewById(R.id.image);
        ImageButton.setBackgroundColor(1);
        ImageButton.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view)
            {
                setContentView(R.id.aaa);
            }
        });
    }
}
XML for first layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.bassammetwally.anew.MainActivity">
    <RelativeLayout
        android:layout_width="420dp"
        android:layout_height="50dp"
        android:background="#3955a1">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Writer's Block"
            android:textColor="#ffffff"
            android:textSize="30dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="4dp"
            android:id="@+id/Asd"/>
        <ImageButton
            android:layout_width="20dp"
            android:layout_height="40dp"
            android:src="@drawable/pen"
            android:layout_marginLeft="380dp"
            android:layout_marginTop="5dp"
            android:scaleType="fitXY"
            android:adjustViewBounds="true"
            android:id="@+id/image"/>
        </RelativeLayout>
</LinearLayout>
Second layout to change to;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/aaa">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Ans"/>
</LinearLayout>
I think it might have something to do with my syntax.
 
     
    