How do I access variables from a class of inner method in Java?

104 views Asked by At

I have an object mPhotoView which is declared and defined in a class (outer class?) CrimeFragment. I want to access a variable defined in a method of method of mPhotoView.

mPhotoView = (ImageView)v.findViewById(R.id.crime_photo);
    mPhotoView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            int thumbnailHeight = mPhotoView.getHeight();
            int thumbnailWidth =  mPhotoView.getWidth();
        }
    });
    updatePhotoView(thumbnailHeight, thumbnailWidth); // shows error here. 

How do I achieve this?

(I tried declaring the variables as static/final and tried using this/super randomly. I do not understand the basics clearly.)

0

There are 0 answers