Attempt to invoke virtual method 'java.lang.String java.lang.String.toUpperCase()' on a null object reference

MalkAlashter :

The app stopped during getting the location from Gps.

PrayerTimes Class

The app stopped during getting the location from Gps.

in these two lines

    public static Mazhab getDefaultMazhab(String countryCode) {
        countryCode = countryCode.toUpperCase();

        if("AF, AL, EG".contains (countryCode)) return Mazhab.PTC_MAZHAB_SHAFEI;

        return Mazhab.PTC_MAZHAB_HANAFI;
    }

    public static Way getDefaultWay(String countryCode) {
        countryCode = countryCode.toUpperCase();

        if("CM, CF, CD, CG, CI, EG, GH, IQ, KE, LY, MY, ML, SN, SO, SD, TN".indexOf(countryCode)>=0) return Way.PTC_WAY_EGYPT;

        if("AF, AL, BD, IN, PK, WF".indexOf(countryCode)>=0) return Way.PTC_WAY_KARACHI;

        if("CA, US".indexOf(countryCode)>=0) return Way.PTC_WAY_ISNA;

        if("BH, KW, OM, QA, SA, AE, YE".indexOf(countryCode)>=0) return Way.PTC_WAY_UMQURA;

        return Way.PTC_WAY_MWL;
    }
}

LogCat

from LogCat

Attempt to invoke virtual method 'java.lang.String java.lang.String.toUpperCase()' on a null object reference

at

at mindtrack.muslimorganizer.calculator.prayer.PrayerTimes.getDefaultMazhab(PrayerTimes.java:282)
        at mindtrack.muslimorganizer.ui.activity.MainActivity.onLocationChanged(MainActivity.java:324)
MMG :

countryCode in getDefaultMazhab is null. Put if(countryCode!=null) before that line

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Attempt to invoke virtual method 'java.lang.String com.marsad.earningapp.model.RegisterModel.getName()' on a null object reference

NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference

Android: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference

Attempt to invoke virtual method 'android.content.Context.getSharedPreferences(java.lang.String, int)' on a null object reference

NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getUid()' on a null object reference

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.isEmpty()' on a null object reference

Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference. Invalid API address Crash

Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference

Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getIdName()' on a null object reference

Upload image error: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getLastPathSegment()' on a null object reference

Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference at

Attempt to invoke virtual method 'boolean java.lang.String.contains(java.lang.CharSequence)' on a null object reference

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference

Android. Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.trim()' on a null object reference

Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference on Volley while executing Swiperefresh Android

Attempt to invoke virtual method 'getSystemService(java.lang.String)' on a null object reference

Service (Android Notification): Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

java.lang.NullPointerException: Attempt to invoke virtual method (java.lang.String)' on a null object reference

Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference NFC

JSONArray exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference (MessageActivity.java:150)

Attempt to invoke virtual method 'java.lang.String okhttp3.ResponseBody.string()' on a null object reference

Attempt to invoke virtual method 'java.lang.String at.huber.youtubeExtractor.YtFile.getUrl()' on a null object reference

(Android) When Back pressed, Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference

Attempt to invoke virtual method boolean java.lang.String.equals(java.lang.Object) on a null object reference in android studio firebase mainactivity

TOP Ranking

HotTag

Archive