Q:

android animation only working first click

I have a button and an imageview. The intention is to animate imageview each time the button is clicked. However i can do it only on the first click. 
The subsequent click doesn't animate the imageviw. Im not sure why this is happening. Thanks
    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            final ImageView image = findViewById(R.id.image);
            final Button button = findViewById(R.id.button);

            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    image.setVisibility(View.VISIBLE);
                    image.animate().scaleX(1.4f).scaleY(1.4f).setDuration(200).start();

                    final Handler handler = new Handler();
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Thread.sleep(500);
                                handler.post(new Runnable() {
                                    @Override
                                    public void run() {
                                        image.setVisibility(View.INVISIBLE);
                                    }
                                });
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                        }
                    }).start();
                }
            });

        }

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="CLICK"/>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/fav"
        android:id="@+id/image"
        android:layout_centerInParent="true"
        android:visibility="invisible"/>
</RelativeLayout>

A:

At a quick look: it could be that the scale of the ImageView is 1.4 times the scale already when second animation starts - so the animation is running from 1.4 to 1.4 and not visible anymore.
My attempt would be to store the scaleX and scaleY prior to the first animation to reset it in your runnable then :)

