heinrichreimer / material-intro

A simple material design app intro with cool animations and a fluent API.

Home Page:https://jitpack.io/#com.heinrichreimer/material-intro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I build slideshow, No error but app is not ruing in ADB. showing shome coused

ejaki943 opened this issue · comments

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 {

ViewPager viewPager;

BottomNavigationView bottomNavigationView;


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

    viewPager = (ViewPager)findViewById(R.id.myViewPager);

    ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(this);

    viewPager.setAdapter(viewPagerAdapter);

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.