The app crashes as soon as I launch it so I'm guessing there is something wrong in the onCreate method. Also, my XML file is too large so if you need more references from it do ask I'll attach it separately.Also for the logcat. I don't yet know how to figure out a problem using the logcat so if you need that reference too, I'll provide that too.
package com.example.gazzupv2; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; import android.widget.TextView; import com.google.android.material.navigation.NavigationView; import com.miguelcatalan.materialsearchview.MaterialSearchView; public class Home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{ DrawerLayout drawerLayout; ActionBarDrawerToggle actionBarDrawerToggle; Toolbar toolbar, searchToolbar; NavigationView navigationView; MaterialSearchView searchView; TextView titleText;
I'm guessing there is something wrong here
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home); toolbar = findViewById(R.id.toolbar); titleText = findViewById(R.id.toolbarTitle); searchToolbar = (Toolbar)findViewById(R.id.search_toolbar); setSupportActionBar(toolbar); searchView=(MaterialSearchView)findViewById(R.id.search_view); drawerLayout = findViewById(R.id.drawer); navigationView = findViewById(R.id.navigationView); navigationView.setNavigationItemSelectedListener(this); actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.Open, R.string.Close); drawerLayout.addDrawerListener(actionBarDrawerToggle); actionBarDrawerToggle.setDrawerIndicatorEnabled(true); actionBarDrawerToggle.syncState(); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { drawerLayout.closeDrawer(GravityCompat.START); if (item.getItemId() == R.id.home) { Intent home = new Intent(getApplicationContext(), Home.class); startActivity(home); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } if (item.getItemId() == R.id.myOrders) { Intent home = new Intent(getApplicationContext(), MyOrders.class); startActivity(home); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } if (item.getItemId() == R.id.feedback) { Intent home = new Intent(getApplicationContext(), Feedback.class); startActivity(home); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } if (item.getItemId() == R.id.refer) { Intent home = new Intent(getApplicationContext(), Refer.class); startActivity(home); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } if (item.getItemId() == R.id.settings) { Intent home = new Intent(getApplicationContext(), Settings.class); startActivity(home); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } if (item.getItemId() == R.id.logOut) { Intent home = new Intent(getApplicationContext(), LogIn.class); startActivity(home); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } if (item.getItemId() == R.id.contact) { Intent home = new Intent(getApplicationContext(), Contact.class); startActivity(home); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } if (item.getItemId() == R.id.terms) { Intent home = new Intent(getApplicationContext(), Terms.class); startActivity(home); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } return true; } }