Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/311.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.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
Java 方法不';t重写其超类中的方法_Java_Android_Google Maps - Fatal编程技术网

Java 方法不';t重写其超类中的方法

Java 方法不';t重写其超类中的方法,java,android,google-maps,Java,Android,Google Maps,我正在使用Google PlacePicker API制作一个简单的Android应用程序来获取用户的位置,我得到了以下错误: @Override方法给出错误“方法不从其超类重写方法” 下面是我的代码: public class placepicker extends AppCompatActivity { TextView locationtext; private final int REQUEST_CODE_PLACEPICKER = 1; @Override

我正在使用Google PlacePicker API制作一个简单的Android应用程序来获取用户的位置,我得到了以下错误:

@Override方法给出错误“方法不从其超类重写方法”

下面是我的代码:

public class placepicker extends AppCompatActivity {

    TextView locationtext;
    private final int REQUEST_CODE_PLACEPICKER = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_placepicker);

        locationtext = (TextView)findViewById(R.id.location);
    }

    public void getlocation(View v){

        startplacepickeractivity();
    }

    private void startplacepickeractivity(){

        PlacePicker.IntentBuilder intentbuilder = new PlacePicker.IntentBuilder();

        try {
           Intent intent = intentbuilder.build(this);
            startActivityForResult(intent , REQUEST_CODE_PLACEPICKER);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Override    << Error is here
    protected void OnActivityResult(int requestCode, int resultCode, Intent data){

        if (requestCode == REQUEST_CODE_PLACEPICKER && resultCode == RESULT_OK){

            displayplace(data);
        }
    }
}
公共类placepicker扩展了AppCompative活动{
文本视图位置文本;
私有最终整数请求\代码\位置选择器=1;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity\u placepicker);
locationtext=(TextView)findViewById(R.id.location);
}
公共位置(视图v){
startplacepickeractivity();
}
私有无效startplacepickeractivity(){
PlacePicker.IntentBuilder IntentBuilder=新的PlacePicker.IntentBuilder();
试一试{
Intent=intentbuilder.build(this);
startActivityForResult(意图、请求、代码、位置选择器);
}捕获(例外e){
e、 printStackTrace();
}
}

@重写您重写了错误的超类函数。
onActivityResult
是正确的函数。请使用此函数

 @Override    
protected void onActivityResult(int requestCode, int resultCode, Intent data){

    if (requestCode == REQUEST_CODE_PLACEPICKER && resultCode == RESULT_OK){

        displayplace(data);
    }
}

我很确定
o
是一个小写的
o
。注释正在做它确切的工作。请注意,您通常可以让IDE自动完成这些名称,既节省了时间又避免了这种错误。@Sweeper谢谢,这只是这里的输入错误:)1)您必须解释问题是什么,以及您的代码是如何解决的。不要ust转储代码并走开;2)有一个用于拼写错误的主题外标志。谢谢它起作用:)只是有一个拼写错误