Closed ejaki943 closed 4 years ago
The activity class you posted does not include any material-intro code, neither does the stacktrace.
Nonetheless, it seems as if Android could not find your view pager. Thus the NullPointerException
.
Please check, if the view pager (R.id.myViewPager
) does exist in your layout file.
PS: On GitHub, you can format code with backticks:
```
code
```
Closing the issue since it's unrelated to this library.
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.viewpager.widget.ViewPager.setAdapter(androidx.viewpager.widget.PagerAdapter)' on a null object reference at com.adworld.admin.myapplication.MainActivity.onCreate(MainActivity.java:30)
Java Coding:
package com.adworld.admin.myapplication;
import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager;
import android.os.Bundle; import android.view.MenuItem; import android.widget.FrameLayout;
import com.google.android.material.bottomnavigation.BottomNavigationView;
public class MainActivity extends AppCompatActivity {