应用程序类返回nullpointer

时间:2017-05-04 12:41:46

标签: null-pointer android-application-class

我的AplicationClass ==>

Date

当从其他类调用internetAktif函数时==>

@Override
public void onCreate() {
    super.onCreate();
    mydRef = FirebaseDatabase.getInstance().getReference();
    tipDondur();
}

public static Context context() {
    return app.getApplicationContext();
}

public boolean internetAktif() {
    final ConnectivityManager connectivityManager = ((ConnectivityManager) app
            .getApplicationContext()
            .getSystemService(Context.CONNECTIVITY_SERVICE));
    return connectivityManager.getActiveNetworkInfo() != null &&
            connectivityManager.getActiveNetworkInfo().isConnected();
}

发送错误==>

引起:com.example.ercana.yemekevdefb.App.internetAktif(App.java:38)中的java.lang.NullPointerException:com.example.ercana.yemekevdefb.Splash.onCreate(Splash.java:31)< / p> 这是什么意思?我是如何解决这个问题的?

0 个答案:

没有答案