title: Getting current location coordinates using Place picker google API in android
body: <p>I want to save user form information with location field. For location I want to open google map on some button click and location to be selected when user click on location over map and post-filled location into form.</p>
  
  <p>I am new to android and found place picker as related solution, So
  I have used Place Picker Google API and  I am able to open google map, when I move arrow over preferred location and click on <strong>Select this location (Appearing black color with now coordinates showing under that)</strong>.  </p>
  
  <p>Confirmation box opens with 2 option : </p>
  
  <p>1.) Change location<br>
  2.) Select <strong>(Disabled mode)</strong></p>
  
  <p>I want to select anonymous location and return to main activity.</p>
  
  <p>Below is my code :</p>
  
  <pre><code>private TextView get_place;
  int PLACE_PICKER_REQUEST    =   1;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      get_place   =   (TextView)findViewById(R.id.textView1);
      get_place.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              PlacePicker.IntentBuilder builder   =   new PlacePicker.IntentBuilder();
              Intent intent;
              try {
                  intent  =   builder.build(getApplicationContext());
                  startActivityForResult(intent,PLACE_PICKER_REQUEST );
              } catch (GooglePlayServicesRepairableException e) {
                  e.printStackTrace();
              } catch (GooglePlayServicesNotAvailableException e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  protected void onActivityResult( int requestCode , int resultCode , Intent data ){
      if( requestCode == PLACE_PICKER_REQUEST)
      {
          if(resultCode == RESULT_OK)
          {
              Place place =   PlacePicker.getPlace(data,this);
              Double latitude = place.getLatLng().latitude;
              Double longitude = place.getLatLng().longitude;
              String address = String.valueOf(latitude)+String.valueOf(longitude);
              get_place.setText(address);
          }
      }
  }
  </code></pre>
  
  <p>Please let me know, If there is any other best solution.
  Code reply will be much helpful or reference link.</p>