android - When I try to call LocationClient.connect(), I got NumberFormatException -


i download project example google(locationupdates.zip, http://developer.android.com/training/location/retrieve-current.html). when ran it, showed exception follows, not always:

08-10 16:10:34.119: w/system.err(26914): java.lang.numberformatexception: invalid int: "" 08-10 16:10:34.127: w/system.err(26914):    @ java.lang.integer.invalidint(integer.java:138) 08-10 16:10:34.127: w/system.err(26914):    @ java.lang.integer.parseint(integer.java:359) 08-10 16:10:34.127: w/system.err(26914):    @ java.lang.integer.parseint(integer.java:332) 08-10 16:10:34.127: w/system.err(26914):    @ java.util.calendar.gethwfirstdayofweek(calendar.java:807) 08-10 16:10:34.127: w/system.err(26914):    @ java.util.calendar.<init>(calendar.java:745) 08-10 16:10:34.127: w/system.err(26914):    @ java.util.gregoriancalendar.<init>(gregoriancalendar.java:338) 08-10 16:10:34.127: w/system.err(26914):    @ java.util.gregoriancalendar.<init>(gregoriancalendar.java:325) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.asn1time.getdecodedobject(asn1time.java:44) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.asn1utctime.decode(asn1utctime.java:82) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.asn1choice.decode(asn1choice.java:308) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.berinputstream.readsequence(berinputstream.java:554) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.derinputstream.readsequence(derinputstream.java:105) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.asn1sequence.decode(asn1sequence.java:40) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.berinputstream.readsequence(berinputstream.java:554) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.derinputstream.readsequence(derinputstream.java:105) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.asn1sequence.decode(asn1sequence.java:40) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.berinputstream.readsequence(berinputstream.java:554) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.derinputstream.readsequence(derinputstream.java:105) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.asn1sequence.decode(asn1sequence.java:40) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.asn1.asn1type.decode(asn1type.java:91) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.provider.cert.x509certimpl.<init>(x509certimpl.java:102) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.provider.cert.x509certfactoryimpl.getcertificate(x509certfactoryimpl.java:656) 08-10 16:10:34.127: w/system.err(26914):    @ org.apache.harmony.security.provider.cert.x509certfactoryimpl.enginegeneratecertificate(x509certfactoryimpl.java:109) 08-10 16:10:34.127: w/system.err(26914):    @ java.security.cert.certificatefactory.generatecertificate(certificatefactory.java:195) 08-10 16:10:34.135: w/system.err(26914):    @ com.google.android.gms.common.googleplayservicesutil.a(unknown source) 08-10 16:10:34.135: w/system.err(26914):    @ com.google.android.gms.common.googleplayservicesutil.isgoogleplayservicesavailable(unknown source) 08-10 16:10:34.135: w/system.err(26914):    @ com.google.android.gms.internal.p.connect(unknown source) 08-10 16:10:34.135: w/system.err(26914):    @ com.google.android.gms.location.locationclient.connect(unknown source) 08-10 16:10:34.135: w/system.err(26914):    @ com.example.android.location.mainactivity.onstart(mainactivity.java:197) 08-10 16:10:34.135: w/system.err(26914):    @ android.app.instrumentation.callactivityonstart(instrumentation.java:1133) 08-10 16:10:34.135: w/system.err(26914):    @ android.app.activity.performstart(activity.java:4475) 08-10 16:10:34.135: w/system.err(26914):    @ android.app.activitythread.performlaunchactivity(activitythread.java:1929) 08-10 16:10:34.135: w/system.err(26914):    @ android.app.activitythread.handlelaunchactivity(activitythread.java:1981) 08-10 16:10:34.135: w/system.err(26914):    @ android.app.activitythread.access$600(activitythread.java:123) 08-10 16:10:34.135: w/system.err(26914):    @ android.app.activitythread$h.handlemessage(activitythread.java:1147) 08-10 16:10:34.135: w/system.err(26914):    @ android.os.handler.dispatchmessage(handler.java:99) 08-10 16:10:34.135: w/system.err(26914):    @ android.os.looper.loop(looper.java:137) 08-10 16:10:34.135: w/system.err(26914):    @ android.app.activitythread.main(activitythread.java:4424) 08-10 16:10:34.135: w/system.err(26914):    @ java.lang.reflect.method.invokenative(native method) 08-10 16:10:34.135: w/system.err(26914):    @ java.lang.reflect.method.invoke(method.java:511) 08-10 16:10:34.135: w/system.err(26914):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:791) 08-10 16:10:34.135: w/system.err(26914):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:558) 08-10 16:10:34.135: w/system.err(26914):    @ dalvik.system.nativestart.main(native method) 

the code here:

public class mainactivity extends fragmentactivity implements     locationlistener,     googleplayservicesclient.connectioncallbacks,     googleplayservicesclient.onconnectionfailedlistener {  // request connect location services private locationrequest mlocationrequest;  // stores current instantiation of location client in object private locationclient mlocationclient; ...... } ...... public void onstart() {      log.i(tag, "onstart of mainactivity");     super.onstart();      /*      * connect client. don't re-start requests here;      * instead, wait onresume()      */     log.i(tag, "connect() of locationclient begin");     mlocationclient.connect();     log.i(tag, "connect() of locationclient finish");  } 

the exception because sentence:

mlocationclient.connect(); 

there project when try new mimemessage, throw same exception: numberformatexception:

mimemessage message = new mimemessage(session); 

in fact, in projects, there many scenarios throw out kinds of exception didn't operate number/time related variable. guy has same problem me. android error in java inputstreamreader huawei phone

i struggled exception many days. don't know why. hope android experts can me. all. mobile huawei ascend d1 dual.

you may need declare locationclient mlocationclient; as class variable


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -