I am making a project in android studio.I am trying to move background image by Thread on running the app but when i am running the app it gives a message 'unfortunately stopped' . How can I move background image by Thread or anything using android studio ? Anyone please help me ?
//Xml:
<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/bg2"
    android:scaleType="fitXY"
    android:id="@+id/image_id"
    />
//java:
image=(ImageView)findViewById(R.id.image_id);  // image is an ImageView type object
Thread an=new Thread(){
        @Override
        public void run() {
            super.run();
            for(;x<=200;)
            {
                x++;
                image.setX(x);
                image.setY(0);
                System.out.println("Value of x: "+x);
                try
                {
                    sleep(1000);
                }catch(Exception e)
                {
                    System.out.println("Exception: "+e);
                }
            }
        }
    };an.start();
 
     
     
    