public class MainActivity extends AppCompatActivity {
ArrayList<Books_item> items = new ArrayList<>();
BooksAdapter adapter;
ListView listView;
private DrawerLayout nDrawerLayout;
private ActionBarDrawerToggle nToggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
nDrawerLayout=(DrawerLayout) findViewById(R.id.drawerlayout);
nToggle= new ActionBarDrawerToggle(this,nDrawerLayout,R.string.open,R.string.close);
nDrawerLayout.addDrawerListener(nToggle);
nToggle.syncState();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.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:id="@+id/drawerlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- tools:context=".MainActivity">-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#ca1515"
/>
<ListView
android:id="@+id/book_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:menu="@menu/navigation_menu"
android:layout_gravity="start">
</android.support.design.widget.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>
i'm trying to add fragment menu ,but i have this bug appear after run there's no error appear when i build
and why i have (DrawerLayout) as unused
Report unnecessary cast expressions
i tried add >import com.your.package.R