小编Col*_*law的帖子

Google PlacePicker在发布后立即关闭

我正在开发一个Android应用程序,并正在研究Google Places以获取应用程序中的某些功能.谷歌最近发布了我正在使用的PlacePicker功能.我遵循了Google指南和"T"的快速入门指南.这个功能在三小时前工作得很好,现在当我去测试它时,它启动然后立即关闭,堆栈跟踪中没有错误.以下是我使用代码的方式:

这是一个片段.

// The Location Selection from Google Place Picker
where.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        try {
            launchPlace();
        } catch (GooglePlayServicesNotAvailableException |  GooglePlayServicesRepairableException e) {
            e.printStackTrace();
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

这是在onCreateView的片段内.

方法launchPlace()定义如下.

// Start Google Place Picker Code **************************************************************
public void launchPlace() throws GooglePlayServicesNotAvailableException,
        GooglePlayServicesRepairableException {
    PLACE_PICKER_REQUEST = 1;
    PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();

    Context context = getActivity().getApplicationContext();
    startActivityForResult(builder.build(context), PLACE_PICKER_REQUEST);
}

public void onActivityResult(int requestCode, int resultCode, Intent data) {

    String badLocation = "That location is …
Run Code Online (Sandbox Code Playgroud)

android android-fragments google-places

32
推荐指数
3
解决办法
2万
查看次数

标签 统计

android ×1

android-fragments ×1

google-places ×1