java - Attempt to invoke virtual method. App to display Location -


I am trying to create an Android app that displays the current (or the last known location) of the device. This error, which is shown in lockback:

07-27 14: 47: 53.766: E / Android Time (28080): Reasons for: java.lang.NullPointerException: Applying the Virtual Method Attempt to 'double object' on 'Null object reference' Location '' place.Getlighttime () '' '

This is my Java code:

  Package Com. Examples. Atosilens; Import android App Import android.content.Context; Import android.location.Location; Import android.location.LocationManager; Importroid.os.Bundle; Import android.view.Menu; Import android.widget.TextView; Public class increases main activity activity (textview lat = (text view) searchVBIID (R.L.L); textview lawn = (text view) Find VVBID (R. deidel); Int b, c; @ Override protected zero creation ( Bundle saved instenstate) {super.naught (savedinstenstate); setContentView (R.layout.activity_main); LocationManager lm = (LocationManager) getSystemService (context.LOCATION_SERVICE); Location Last Location = lm.getLastKnownLocation (LocationManager.GPS_PROVIDER); If (last Nan! = Null) {lat.setText (double.Tastring (last location.getLyutuude ()); lon.setText (Double.toString (lastLocation.getLongitude ());}} @ Override Public Boolean on Crate Option Menu ( Menu menu) Enhancing the // menu; It adds the item to the Action Bar if it exists GetMenuInflater () .fluo (R. menu menu, menu); back true;}}  
< P> I have already allowed permissions for fine and thick space in the Android manifest, why is this happening?

This can not solve the problem, but before the layout you are getting the idea that the inflated

move TextView lat = (TextView) findViewById ( R.id.lat); Find textview lawn = (text view) VVBIID (R. deDel); setContentView () . onCreate from

after


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -