Search code examples
androidandroid-activitysuperclassuses-feature

Error on the super.onActivityResult() why?


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

    super.onActivityResult(requestCode,resultCode,data)

    if (requestCode == Selectedimage && resultCode == RESULT_OK && data != null) {

        Uri pickedImage = data.getData();
        Intent send= new Intent(Selection.this,Imagepage.class);
        send.putExtra("pickedImage",pickedImage.toString());
        startActivity(send);
    }
}

what is the use of adding that super.onActivityResult line ? and also when am adding that, its showing some error.


Solution

  • First of all, if you get an error - always show logcat. Secondly, if this method is declared in the class extending Activity, there is no need to call super there since this method is empty in the Activity class:

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