How do I get android location once at the push of a button?
<p>I am currently making an application where I need to get the user's location when a button is clicked. I am using <a href="https://github.com/googlesamples/android-play-location/tree/master/LocationUpdates" rel="nofollow">this</a> sample and it works great as a sample application. My question is, how would I implement it into my application button's <em>onClick</em> event? I don't need it to refresh often, I just need it so that when the user clicks the button, it gets the user's latitude and longitude and saves them to two variables. What would be the best way to do this? I didn't post my own code because all I have is a button with an <em>onClick</em> event.</p>