Как изменить textview в drawer header из activity?

Всем доброго времени суток. Не могу понять, как изменить textview drawer хедера. Когда привязываю объект textview с айди, выходит nullpointerexception. Также не отображается картинка. Заранее спасибо.

activity_dashboard.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DashboardActivity"
android:id="@+id/drawer">

    <include
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            layout="@layout/content_main"
            />

<android.support.design.widget.NavigationView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/navigationView"
        app:menu="@menu/drawer_menu"
        app:headerLayout="@layout/drawer_header"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        />
    <RelativeLayout

            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context=".DashboardActivity">

        <android.support.v7.widget.Toolbar
                android:layout_height="?attr/actionBarSize"
                android:layout_width="match_parent"
                android:background="#f4f6f8"
                android:id="@+id/toolbar"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintStart_toStartOf="parent" />


        <android.support.v7.widget.RecyclerView
                android:layout_below="@+id/toolbar"
                android:id="@+id/rv_dashboard"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                />


        <android.support.design.widget.FloatingActionButton
                android:id="@+id/fab_dashboard"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                android:src="@drawable/plus"
                app:backgroundTint="#f4f6f8"
                android:layout_marginTop="16dp"
                android:layout_marginStart="16dp"
                android:layout_marginEnd="16dp"
                android:layout_marginBottom="16dp" />

    </RelativeLayout>
</android.support.v4.widget.DrawerLayout>

drawer_header.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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="150sp">

    <ImageView
            android:layout_width="101sp"
            android:layout_height="90sp"
            tools:srcCompat="@tools:sample/avatars"
            android:id="@+id/imageView"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            android:layout_marginTop="16dp"
            android:layout_marginStart="16dp" />

    <TextView
            android:layout_width="300sp"
            android:layout_height="26sp"
            android:id="@+id/emailview"
            app:layout_constraintTop_toBottomOf="@+id/imageView"
            android:layout_marginTop="8dp"
            app:layout_constraintStart_toStartOf="parent"
            android:layout_marginStart="16sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintVertical_bias="0.0" />
</android.support.constraint.ConstraintLayout>

drawer_toolbar.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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">

    <android.support.v7.widget.Toolbar
            android:layout_height="?attr/actionBarSize"
            android:layout_width="match_parent"
            android:background="@color/colorPrimaryDark"
            android:id="@+id/toolbar"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

</android.support.constraint.ConstraintLayout>

content_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent" android:layout_height="match_parent">

    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/container_fragment" />

</android.support.constraint.ConstraintLayout>

DashboardActivity.java:

 @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dashboard);

        activity = this;
        dbHandler = new DBHandler(activity);
        requestHandler = new RequestHandler();

        boolean check_login = getIntent().getBooleanExtra("check", false);

        if (!check_login) {
            token = getIntent().getStringExtra("token");
            userId = getIntent().getStringExtra("userId");
            email = getIntent().getStringExtra("email");
            createUser();
        }
        else {
            email = getIntent().getStringExtra("email");
            token = dbHandler.getToken();
        }



        rv_dashboard = findViewById(R.id.rv_dashboard);
        rv_dashboard.setLayoutManager(new LinearLayoutManager(this));

        drawerLayout = findViewById(R.id.drawer);
        navigationView = findViewById(R.id.navigationView);

        toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open, R.string.close);

        drawerLayout.addDrawerListener(actionBarDrawerToggle);
        actionBarDrawerToggle.setDrawerIndicatorEnabled(true);
        actionBarDrawerToggle.syncState();
}

Activity

drawer

Также почему-то не отрисовывается картинка: pic


Ответы (0 шт):