vikktorn / ExampleCountryPicker

Android Country, State/Region, City picker
9 stars 4 forks source link

when i click third button city picker it will raise null object reference #1

Open shailendra-rajpoot opened 5 years ago

shailendra-rajpoot commented 5 years ago

12-31 15:00:07.817 21796-21796/com.zealtechnology.citystate E/Process: android_os_Process_getProcessNameByPid pid is 21796 android_os_Process_getProcessNameByPid value is ology.citystate 12-31 15:00:27.917 21796-21796/com.zealtechnology.citystate E/AndroidRuntime: FATAL EXCEPTION: main Process: com.zealtechnology.citystate, PID: 21796 java.lang.NullPointerException: Attempt to invoke virtual method 'void com.vikktorn.picker.CityPicker.showDialog(android.support.v4.app.FragmentManager)' on a null object reference at com.zealtechnology.citystate.MainActivity$3.onClick(MainActivity.java:130) at android.view.View.performClick(View.java:4781) at android.view.View$PerformClick.run(View.java:19907) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:160) at android.app.ActivityThread.main(ActivityThread.java:5541) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)

amirul12 commented 5 years ago

When I click the city picker then throw the exception java.lang.IllegalArgumentException: No Cities Found! Did you call build() at com.vikktorn.picker.CityPicker.showDialog(CityPicker.java:93) at com.mandsti.amirul.countryandstrippayment.MainActivity$1.onClick(MainActivity.java:81) at android.view.View.performClick(View.java:5740) at android.view.View$PerformClick.run(View.java:22947) at android.os.Handler.handleCallback(Handler.java:836) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:232) at android.app.ActivityThread.main(ActivityThread.java:6661) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1106) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

princewaqasg commented 5 years ago

some times when i select city then Application crushes. most of the exception happen when i select state and then select the city then on this application crushes. how can it fix?

--------- beginning of crash 2019-02-20 13:17:10.028 11209-11209/com.working.locationsis.location E/AndroidRuntime: FATAL EXCEPTION: main Process: com.working.locationsis.location, PID: 11209 java.lang.IllegalArgumentException: No Cities Found! Did you call build() at com.vikktorn.picker.CityPicker.showDialog(CityPicker.java:93) at com.working.locationsis.location.MainActivity$3.onClick(MainActivity.java:133) at android.view.View.performClick(View.java:6390) at android.view.View$PerformClick.run(View.java:25270) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:187) at android.app.ActivityThread.main(ActivityThread.java:7025) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:514) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888) 2019-02-20 13:17:10.066 11209-11209/com.working.locationsis.location I/Process: Sending signal. PID: 11209 SIG: 9

vikktorn commented 5 years ago

This is becouse I don't have all cities from all countries and when json is empty for city app crash. YOU CAN UPDATE JSON FILE WITH CITY THAT YOU NEED

Viktor Nesic

On Wed, Feb 20, 2019, 9:13 AM princewaqasg <notifications@github.com wrote:

some times when i select city then Application crushes. most of the exception happen when i select state and then select the city then on this application crushes. how can it fix?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vikktorn/ExampleCountryPicker/issues/1#issuecomment-465469963, or mute the thread https://github.com/notifications/unsubscribe-auth/APa1-tyt93H1pXwyFX2sLus8H2quBoROks5vPQOugaJpZM4ZlUUP .

princewaqasg commented 5 years ago

sir where is JSON file that i will update. can you tell me path

vikktorn commented 5 years ago

I must check and telly little later

Viktor Nesic

On Wed, Feb 20, 2019, 2:14 PM princewaqasg <notifications@github.com wrote:

sir where is JSON file that i will update. can you tell me path

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vikktorn/ExampleCountryPicker/issues/1#issuecomment-465568704, or mute the thread https://github.com/notifications/unsubscribe-auth/APa1-pNyWp3Dx3KCrGXx2p3P4SIwQ7T9ks5vPUo6gaJpZM4ZlUUP .

princewaqasg commented 5 years ago

thank you sir,

vikktorn commented 5 years ago

https://we.tl/t-JM9bJHgxDF Download this zip file from link. Unpack it and open in Android Studio There is app, and picker Library In picker library in asset folder you have two JSON files cities.json and states.json they are connected by state_id, so for your state id enter new city in city.json and picker will work. also you can add state for country_id that is missing , you have CountryPicker.java class in java classes of picker library, here you can also add new country that is missing , with flag, country_id ......... Hope you understand what you have to do and later you can use this in your project where you need it

On Wed, Feb 20, 2019 at 2:19 PM princewaqasg notifications@github.com wrote:

thank you sir,

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vikktorn/ExampleCountryPicker/issues/1#issuecomment-465570497, or mute the thread https://github.com/notifications/unsubscribe-auth/APa1-hxY2mTi3jK8fQ3jhhA2d29LKJSvks5vPUt3gaJpZM4ZlUUP .

princewaqasg commented 5 years ago

Thank you Sir Thanks a lot You are 100% helpful thank you sir

hvar90 commented 5 years ago

i think is more useful only country and cities is posible ue your library for choosing the country and showing all the cities?

hvar90 commented 5 years ago

Thank you Sir Thanks a lot You are 100% helpful thank you sir

have you completed the JSON ? you should to share it so we could use it