java.lang.NullPointerException GoogleMaps V2

后端 未结 4 1848
闹比i
闹比i 2021-01-20 23:40

i just learning about android programming to show map. but when i run this code ,there\'s some error. Can anybody explain why this error occurs? And what I can do to fix this pr

4条回答
  •  失恋的感觉
    2021-01-20 23:43

    Above mentioned problem can occur if you have emulator or device in which google play services are not installed. I don't have perfect solution but I figured out some work around to save your app from crashing. In this case you have to follow simple steps 1. Override startActivityForResult(intent, requestcode) 2. In startActivityForResult add super call super.startActivityForResult in try catch and catch the NullPointerException

    Easy its done Now you can trap the nullpointerexception here and add your error handling in catch

提交回复
热议问题