public void startChooseLocationActivity (Activity activity, Result resultHandler) throws Exception { this.resultHandler = resultHandler; this.activity = activity; PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); try { Intent intent = builder.build(activity); activity.startActivityForResult(intent, PICK_LOCATION); } catch (GooglePlayServicesRepairableException e) { throw new Exception(e.getMessage()); } // Intent intent = new Intent(context, ChatSDKLocationActivity.class); }
public void openPlaceAutoCompleteView() { mMap.clear(); this.listLatLng.clear(); try { Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .build(this); startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE); } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_AUTOCOMPLETE_REQUEST_CODE) { if (resultCode == RESULT_OK) { Place place = PlaceAutocomplete.getPlace(this, data); destination = place.getLatLng(); setUpPolyLine(); } else if (resultCode == PlaceAutocomplete.RESULT_ERROR) { Status status = PlaceAutocomplete.getStatus(this, data); Toast.makeText(this, "Error " + status, Toast.LENGTH_SHORT).show(); } else if (resultCode == RESULT_CANCELED) { // The user canceled the operation. } } }
protected void processPickedLocation(int resultCode, Intent data) throws Exception { if (resultCode == AppCompatActivity.RESULT_OK) { // Send the message, Params Latitude, Longitude, Base64 Representation of the messageImageView of the location, threadId. if(resultHandler != null) { Place place = PlacePicker.getPlace(activity, data); resultHandler.result("", place.getLatLng()); } } }
private void openGooglePlacePicker() { try { progressDialog.show(); PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); startActivityForResult(builder.build(getActivity()), PLACE_PICKER_REQUEST); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); Toast.makeText(getActivity(), getString(R.string.toast_google_service_not_work), Toast.LENGTH_LONG).show(); progressDialog.dismiss(); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); Toast.makeText(getActivity(), getString(R.string.toast_google_service_not_work), Toast.LENGTH_LONG).show(); progressDialog.dismiss(); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST) { if (resultCode == RESULT_OK) { Place place = PlacePicker.getPlace(getActivity(), data); if (place.getName() != null || !place.getName().equals("")) { //try to spilt the string if it is a local TV_diary_location.setText(place.getName()); isLocation = true; } else { isLocation = false; } initLocationIcon(); } progressDialog.dismiss(); } }
private void openGooglePlacePicker() { if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getContext()) == ConnectionResult.SUCCESS) { try { progressDialog.show(); PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); startActivityForResult(builder.build(getActivity()), PLACE_PICKER_REQUEST); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); progressDialog.dismiss(); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); progressDialog.dismiss(); } } else { Toast.makeText(getActivity(), getString(R.string.toast_google_service_not_work), Toast.LENGTH_LONG).show(); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST) { if (resultCode == RESULT_OK) { Place place = PlacePicker.getPlace(getActivity(), data); if (place.getName() != null || !place.getName().equals("")) { //try to spilt the string if it is a local TV_diary_location.setText(place.getName()); haveLocation = true; } else { haveLocation = false; } initLocationIcon(); } progressDialog.dismiss(); } }
@Override public void onClick(View view) { try { // Intent intent = // new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY).build(activity); // startActivityForResult(intent, AUTOCOMPLETE_DESTINATITON); PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); startActivityForResult(builder.build(activity), AUTOCOMPLETE_DESTINATITON); } catch (GooglePlayServicesRepairableException e) { // TODO: Handle the error. // Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show(); } catch (GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. // Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show(); } } });
protected void onActivityResult( int requestCode, int resultCode, Intent data ) { if( requestCode == PLACE_PICKER_REQUEST && resultCode == RESULT_OK ) { displayPlace( PlacePicker.getPlace( data, this ) ); } } private void guessCurrentPlace() {
@Override public void onClick(View view) { try { // Intent intent = // new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY).build(activity); // startActivityForResult(intent, AUTOCOMPLETE_SOURCE); PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); startActivityForResult(builder.build(activity), AUTOCOMPLETE_SOURCE); } catch (GooglePlayServicesRepairableException e) { // TODO: Handle the error. // Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show(); } catch (GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. // Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show(); } } });
protected void onActivityResult( int requestCode, int resultCode, Intent data ) { if( requestCode == PLACE_PICKER_REQUEST && resultCode == RESULT_OK ) { mPlaceTujuan=PlacePicker.getPlace( data, this ); displayPlace( mPlaceTujuan ); } }
private void pickLocation() { try { PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); startActivityForResult(builder.build(this), REQUEST_PLACE_PICKER); } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { Toast.makeText(this, R.string.placePickerNotAvailable, Toast.LENGTH_SHORT).show(); } }
protected void onActivityResult( int requestCode, int resultCode, Intent data ) { if( requestCode == PLACE_PICKER_REQUEST && resultCode == RESULT_OK ) { mPlaceTujuan=PlacePicker.getPlace( data, this ); displayPlace( mPlaceTujuan ); } } private void startTimer() {
@Override public void onFocusChange(View view, boolean b) { // Toast.makeText(getApplicationContext(), "Destination", Toast.LENGTH_SHORT).show(); if (b) { try { // Intent intent = // new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY).build(activity); // startActivityForResult(intent, AUTOCOMPLETE_DESTINATITON); PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); startActivityForResult(builder.build(activity), AUTOCOMPLETE_DESTINATITON); } catch (GooglePlayServicesRepairableException e) { // TODO: Handle the error. // Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show(); } catch (GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. // Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show(); } } } });
protected void onActivityResult( int requestCode, int resultCode, Intent data ) { if( requestCode == PLACE_PICKER_REQUEST && resultCode == RESULT_OK ) { displayPlace( PlacePicker.getPlace( data, this ) ); } } private void guessCurrentPlace() {
@Override public void onFocusChange(View view, boolean b) { if (b) { try { // Intent intent = // new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY).build(activity); // startActivityForResult(intent, AUTOCOMPLETE_SOURCE); PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); startActivityForResult(builder.build(activity), AUTOCOMPLETE_SOURCE); } catch (GooglePlayServicesRepairableException e) { // TODO: Handle the error. // Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show(); } catch (GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. // Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show(); } } } });
@Override public void onClick(View v) { PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); try { // Launch the PlacePicker. startActivityForResult(builder.build(MainActivity.this) , REQUEST_PICK_PLACE); } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } } });
private void displayPlacePicker() { if( mGoogleApiClient == null || !mGoogleApiClient.isConnected() ) return; PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); try { startActivityForResult( builder.build((Activity) getApplicationContext()), PLACE_PICKER_REQUEST ); } catch ( GooglePlayServicesRepairableException e ) { Log.d( "PlacesAPI Demo", "GooglePlayServicesRepairableException thrown" ); } catch ( GooglePlayServicesNotAvailableException e ) { Log.d( "PlacesAPI Demo", "GooglePlayServicesNotAvailableException thrown" ); } }
private void displayPlacePicker() { if( mGoogleApiClient == null || !mGoogleApiClient.isConnected() ) return; PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); try { startActivityForResult( builder.build((Activity) getApplicationContext()), PLACE_PICKER_REQUEST ); } catch ( GooglePlayServicesRepairableException e ) { Log.d( "PlacesAPI Demo", "GooglePlayServicesRepairableException thrown" ); } catch ( GooglePlayServicesNotAvailableException e ) { Log.d( "PlacesAPI Demo", "GooglePlayServicesNotAvailableException thrown" ); } }