PhotoVIewAttacher and PIcasso unzoom picture on fragment change

Ok, so, I have implemented photoviewattacher and picasso into one imageview, when I swipe image 1 to change the picture to image 2 and try to get back, the image 1 is still zoomed where I left it. How to solve this? Here is the code:

private PhotoViewAttacher mAttacher;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout resource that'll be returned
    View rootView = inflater.inflate(R.layout.fragment_katalozi_slike, container, false);

    // Get the arguments that was supplied when
    // the fragment was instantiated in the
    // CustomPagerAdapter
    Bundle args = getArguments();
    final ImageView imageView = (ImageView) rootView.findViewById(R.id.imageViewAdapterZaListanjeKataloga);
    mAttacher = new PhotoViewAttacher(imageView);
    Callback imageLoadedCallback = new Callback() {

        @Override
        public void onSuccess() {
            if (mAttacher != null) {
                mAttacher.update();
            } else {
                mAttacher = new PhotoViewAttacher(imageView);
            }
        }

        @Override
        public void onError() {
            // TODO Auto-generated method stub

        }
    };

    Picasso.with(getActivity()).load(args.getString("url")).placeholder(R.drawable.load).error(R.drawable.error).into(imageView, imageLoadedCallback);

    ((TextView) rootView.findViewById(R.id.brojStranaNaSliciKataloga)).setText(String.valueOf(args.getInt("trenutnaStranica")) + "/" + String.valueOf(args.getInt("konacanBrojStranica")));
    ImageButton imageButton = (ImageButton) rootView.findViewById(R.id.shareButtonKatalozi);
    ImageButton locirajMe = (ImageButton) rootView.findViewById(R.id.locirajButtonKatalozi);
    final String zaShare = args.getString("linkKataloga");

    locirajMe.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getLatLng(String.valueOf(Static.prodavci.getId()));
        }
    });

    imageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            shareIt(zaShare);
        }
    });

    return rootView;
}

Answers


You do

@Override
public void onDestroyView() {
    super.onDestroyView();
    mAttacher.cleanup();

}

worked for me.


Need Your Help

ios Google Geocoding API

iphone ios google-maps

I ran "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true" in iPhone project for getting coordinate of "1600 Amphitheatre Parkway,

css image not showing up

html css

i'm new to css and html.