onActivityResult RESULT_OK can not be resolved to a variable in android?

Solution 1:

RESULT_OK is constant of Activity class. In Activity class you can access directly but in other classes you need to write class name (Activity) also.

Use Activity.RESULT_OK instead of RESULT_OK.


In your case it will be

if (requestCode == CAMERA_REQUEST_CODE && resultCode == Activity.RESULT_OK) {

Solution 2:

In fragment we must use getActivity() method as prefix with RESULT_OK.

In your case it will be:-

if (requestCode == CAMERA_REQUEST_CODE && resultCode == getActivity().RESULT_OK)