Skip to content

Instantly share code, notes, and snippets.

@mayowa-egbewunmi
Created September 4, 2019 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayowa-egbewunmi/830f21b91bdfe54404955711ee9fbe4a to your computer and use it in GitHub Desktop.
Save mayowa-egbewunmi/830f21b91bdfe54404955711ee9fbe4a to your computer and use it in GitHub Desktop.
class LocationActivity : AppCompatActivity() {
private lateinit var locationViewModel: LocationViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_location)
locationViewModel = ViewModelProviders.of(this).get(LocationViewModel::class.java)
}
private fun startLocationUpdate() {
locationViewModel.getLocationData().observe(this, Observer {
latLong.text = getString(R.string.latLong, it.longitude, it.latitude)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment