相关疑难解决方法(0)

Google Places API Android:自动填充过快关闭

我在我的Android应用程序中添加了Place Autocompletion.当我单击按钮(chooseLocationButton)时,它会正确打开自动完成小部件.问题是我想在搜索字段中写一个名字.点击第一次击键后,自动完成小部件关闭,研究没有完成.这是它在Run控制台中编写的内容:

W/IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
Run Code Online (Sandbox Code Playgroud)

这是代码:

AutocompleteFilter.Builder a = new AutocompleteFilter.Builder();
    try {
        final Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
                .setFilter(a.setTypeFilter(AutocompleteFilter.TYPE_FILTER_REGIONS).build())
                .build(this);
        chooseLocationButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE);
            }
        });
    } catch (GooglePlayServicesRepairableException e) {
        e.printStackTrace();
        // TODO handle exception!
    } catch (GooglePlayServicesNotAvailableException e) {
        e.printStackTrace();
        // TODO handle exception! Toast?
    }
Run Code Online (Sandbox Code Playgroud)

当然,我已经在Google Developer Console中启用了Google Places Android API和Google Map android API.此外,我已将API密钥添加到AndroidManifest.xml中,如下所示:

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />
Run Code Online (Sandbox Code Playgroud)

在日志中我观察到:

BasicNetwork.performRequest: …
Run Code Online (Sandbox Code Playgroud)

android google-maps autocomplete google-places-api

6
推荐指数
1
解决办法
6492
查看次数