در کد نوشته شده خطایی نمیبینم به نظرم خطا نا مربوط هست ولی اجازه بیلد شدن نمیده
--------------------
ارور
error: incompatible types: android.widget.Toolbar cannot be converted to androidx.appcompat.widget.Toolbar
setSupportActionBar(toolbar);
^
---------------------------------------------
کلاس add new student
public class AddNewStudentActivity extends AppCompatActivity { private static final String TAG = "AddNewStudentActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_new_student_activity); Toolbar toolbar= findViewById(R.id.toolbar_addnewstudent); setSupportActionBar(toolbar);
-------------------------------------------
add_new_student_activity.xml
<?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> <com.google.android.material.appbar.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <androidx.appcompat.widget.Toolbar android:layout_width="match_parent" android:layout_height="wrap_content" app:titleTextColor="@color/white" android:id="@+id/toolbar_addnewstudent"/> com.google.android.material.appbar.AppBarLayout>