-2

I am using the Place API on Android. As seen in the documentation, for each type of location, there is a code:

public static final int TYPE_RESTAURANT Constant Value: 79

How can I use the String representation directly in my code when comparing?

For example:
if plc = Place.TYPE_RESTAURANT then showToast();

I can create a constants list manually, but there should be a better way doing it directly.

Thanks

Daniel
  • 17
  • 4

1 Answers1

0

I added

import com.google.android.gms.location.places.Place;

and then used

Place.TYPE_RESTAURANT

to do the comparison.

if (plac.getPlace().getPlaceTypes().contains(Place.TYPE_RESTAURANT)) { yourcode here
                                }
Daniel
  • 17
  • 4