protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST) { if (resultCode == RESULT_OK) { Place place = PlacePicker.getPlace(data, this); String toastMsg = String.format("Place: %s", place.getName()); Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show(); } } }
public static void convert(Place place, Struct struct) { if (null == place) { return; } struct.put("Name", place.getName()) .put("StreetAddress", place.getStreetAddress()) .put("CountryCode", place.getCountryCode()) .put("Id", place.getId()) .put("Country", place.getCountry()) .put("PlaceType", place.getPlaceType()) .put("URL", place.getURL()) .put("FullName", place.getFullName()); }
place.getName(),place.getId(), place.getAddress(), place.getPhoneNumber(),place.getWebsiteUri()); MY_ADDRESS=place.getName().toString(); getLatlong(place.getId()); Log.i(TAG, "Place details received: " + place.getName()); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); places.release();
String placeName = String.format("Place: %s", place.getName()); String placeAddress = String.format("Address: %s", place.getAddress()); LatLng toLatLng = place.getLatLng();
status.location = place.getName(); status.country_code = place.getCountryCode();
//1. Search Twitter SearchResults results = twitterTemplate.searchOperations().search("#WinterIsComing"); List<Tweet> tweets = results.getTweets(); int i =0; for (Tweet tweet : tweets) { System.out.println(tweet.getUser().getName() + " Tweeted : "+tweet.getText() + " from " + tweet.getUser().getLocation() + " @ " + tweet.getCreatedAt() + tweet.getUser().getLocation() ); } //2. Search Place by GeoLocation RestTemplate restTemplate = twitterTemplate.getRestTemplate(); GeoTemplate geoTemplate = new GeoTemplate(restTemplate, true, true); List<Place> place = geoTemplate.search(37.423021, -122.083739); for (Place p : place) { System.out.println(p.getName() + " " + p.getCountry() + " "+p.getId()); } //3. Get Twitter UserProfile TwitterProfile userProfile = twitterTemplate.userOperations().getUserProfile(); System.out.println(userProfile.getName()+" has " +userProfile.getFriendsCount() + " friends");
Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId) .setResultCallback(new ResultCallback<PlaceBuffer>() { @Override public void onResult(PlaceBuffer places) { if (places.getStatus().isSuccess() && places.getCount() > 0) { final Place myPlace = places.get(0); Log.i(TAG, "Place found: " + myPlace.getName()); LatLng latlangObj = myPlace.getLatLng(); Log.v("latitude:", "" + latlangObj.latitude); Log.v("longitude:", "" + latlangObj.longitude); } else { Log.e(TAG, "Place not found"); } places.release(); } });
@Override public boolean isKeep(TridentTuple tuple) { Status status = (Status) tuple.get(0); return !(null == status.getPlace() || null == status.getPlace().getCountryCode()); } }
final Place place = PlacePicker.getPlace(this, data); List<Integer> types = place.getPlaceTypes(); for(Integer i : types){ if (i == Place.TYPE_RESTAURANT){ // its restaurant do something final CharSequence name = place.getName(); final CharSequence address = place.getAddress(); String attributions = (String) place.getAttributions(); if (attributions == null) { attributions = ""; } mName.setText(name); mAddress.setText(address); mAttributions.setText(Html.fromHtml(attributions)); } }
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST && resultCode == Activity.RESULT_OK) { final Place place = PlacePicker.getPlace(this, data); final CharSequence name = place.getName(); final CharSequence address = place.getAddress(); String attributions = (String) place.getAttributions(); if (attributions == null) { attributions = ""; } tv4.setText(place.getLatLng().toString()+"\n"+name+"\n"+address+"\n"+attributions); // Add this line to make the lite map show the location you just chose // and set the zoom level (10f is arbitrary) mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(place.getLatLng(), 10f)); } else { super.onActivityResult(requestCode, resultCode, data); } }
place.setContentName(tweet.getPlace().getCountryCode()); place.setContentType("place_country-code"); contents.add(place); String placeNormalized = tweet.getPlace().getFullName(); place.setContentName(placeNormalized); place.setContentType("place_fullname");
public PlaceOverlayItem(Context context, Place p, String type) { super(p.getGeoPoint(), p.getName(), p.getFormatted_address()); int resId = types.get(type); Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), resId); this.marker = new BitmapDrawable(context.getResources(), bmp); super.setMarker(this.marker); this.point = p.getGeoPoint(); this.place = p; }
@Override public boolean equals(Object obj) { if (null == obj) { return false; } if (this == obj) { return true; } return obj instanceof Place && ((Place) obj).getId().equals(this.id); }
String toastMsg = String.format("Place: %s %s", place.getName(), place.getPhoneNumber()); // HERE YOU GET THE NUMBER PHONE. Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show();
@Override public void onStatus(Status status) { HashtagEntity[] hashtagEntities = status.getHashtagEntities(); JetstreamEvent event = new JetstreamEvent(); event.setEventType("TwitterSample"); Place place = status.getPlace(); if (place != null) { event.put("country", place.getCountry()); } event.put("ct", status.getCreatedAt().getTime()); event.put("text", status.getText()); event.put("lang", status.getLang()); event.put("user", status.getUser().getName()); if (hashtagEntities != null && hashtagEntities.length > 0) { StringBuilder s = new StringBuilder(); s.append(hashtagEntities[0].getText()); for (int i = 1; i < hashtagEntities.length; i++) { s.append(","); s.append(hashtagEntities[i].getText()); } event.put("hashtag", s.toString()); } fireSendEvent(event); }
/** * Retrieves the State from Place Object of the Tweet. * * @param status -- Status Object. * @param state -- Current State. * @return State of tweet. */ private final String getStateFromTweetPlaceObject(final Status status, String state) { final Place place = status.getPlace(); if (null == state && null != place) { final String placeName = place.getFullName(); if (null != placeName && 2 < placeName.length()) { final String stateFromPlaceObject = placeName.substring(placeName.length() - 2); LOGGER.debug("State from Place:{}", stateFromPlaceObject); state = (2 == stateFromPlaceObject.length())? stateFromPlaceObject.toUpperCase(): null; } } return state; }
CharSequence attributions = places.getAttributions(); mNameTextView.setText(Html.fromHtml(place.getName() + "")); mAddressTextView.setText(Html.fromHtml(place.getAddress() + "")); mIdTextView.setText(Html.fromHtml(place.getId() + "")); mPhoneTextView.setText(Html.fromHtml(place.getPhoneNumber() + "")); mWebTextView.setText(place.getWebsiteUri() + ""); if (attributions != null) { mAttTextView.setText(Html.fromHtml(attributions.toString()));
if (places.getStatus().isSuccess() && places.getCount() > 0) { final Place myPlace = places.get(0); Log.i(TAG, "Place found: " + myPlace.getName()); mMap.addMarker(new MarkerOptions() .position(myPlace.getLatLng()) .title(myPlace.getName().toString()) .snippet(myPlace.getAddress().toString())); mMap.moveCamera(CameraUpdateFactory.newLatLng(myPlace.getLatLng()));