Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android google mapsplace picker启动后立即关闭_Android_Google Maps - Fatal编程技术网

Android google mapsplace picker启动后立即关闭

Android google mapsplace picker启动后立即关闭,android,google-maps,Android,Google Maps,当尝试创建android时,将选择器放在onclick中 PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); try { Intent intent = builder.build(this); startActivityForResult(intent, PLACE_PICKER_REQUEST);

当尝试创建android时,将选择器放在onclick中

PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
            try {

                Intent intent = builder.build(this);
                startActivityForResult(intent, PLACE_PICKER_REQUEST);
            } catch (GooglePlayServicesRepairableException e) {
                e.printStackTrace();
            } catch (GooglePlayServicesNotAvailableException e) {
                e.printStackTrace();
            }
第二次之后立即打开和关闭选择器 我在舱单上加了

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />


与我的控制台连接后仍然存在相同的问题

此位置选择器已弃用,您需要使用新的位置选择器 在您的应用程序级别渐变中使用此选项 实现'com.google.android.libraries.places:places:1.0.0'

 try {
                Places.initialize(Objects.requireNonNull(this), "YOUR_KEY");
                PlacesClient placesClient = Places.createClient(this);
                List<Place.Field> placeFields = Arrays.asList(Place.Field.ADDRESS,
                        Place.Field.ID,
                        Place.Field.PHONE_NUMBER,
                        Place.Field.LAT_LNG);
                Intent intent = new Autocomplete.IntentBuilder(
                        AutocompleteActivityMode.FULLSCREEN, placeFields)
                        .build(this);
                startActivityForResult(intent, PLACE_PICKER_REQUEST);
            } catch (Exception e) {
                e.printStackTrace();
            }

此位置选择器已弃用。您需要使用新的位置选择器 在您的应用程序级别渐变中使用此选项 实现'com.google.android.libraries.places:places:1.0.0'

 try {
                Places.initialize(Objects.requireNonNull(this), "YOUR_KEY");
                PlacesClient placesClient = Places.createClient(this);
                List<Place.Field> placeFields = Arrays.asList(Place.Field.ADDRESS,
                        Place.Field.ID,
                        Place.Field.PHONE_NUMBER,
                        Place.Field.LAT_LNG);
                Intent intent = new Autocomplete.IntentBuilder(
                        AutocompleteActivityMode.FULLSCREEN, placeFields)
                        .build(this);
                startActivityForResult(intent, PLACE_PICKER_REQUEST);
            } catch (Exception e) {
                e.printStackTrace();
            }

检查此链接,但此方法用于使用自动完成的地点搜索,不包括地点选择器!!!我使用了Autocomplete并进行了工作,但有没有办法像使用新实现的旧方法一样实现位置选择器?位置选择器已被弃用,从现在起,您只能使用Autocomplete places sdkcheck此链接,但使用Autocomplete进行位置搜索的此方法不包括位置选择器!!!我使用了Autocomplete并进行了工作,但有没有办法像使用新实现的旧方法一样实现place picker?place picker已被弃用,从现在起,您只能使用Autocomplete places sdk