0% found this document useful (0 votes)
218 views2 pages

Android Practical No 25 Guide

This document contains code for an Android app that animates an image. The XML layout file defines a linear layout containing an image view and three buttons. The Java code defines an activity class with methods for each button click that start animation sequences - rotating, zooming in/out, and fading in/out the image. When each animation ends, it starts the reverse animation on the image.

Uploaded by

atharvabutte03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
218 views2 pages

Android Practical No 25 Guide

This document contains code for an Android app that animates an image. The XML layout file defines a linear layout containing an image view and three buttons. The Java code defines an activity class with methods for each button click that start animation sequences - rotating, zooming in/out, and fading in/out the image. When each animation ends, it starts the reverse animation on the image.

Uploaded by

atharvabutte03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Code Snippets Overview
  • MainActivity Explanation

Practical No 25

Q1.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<EditText
android:id="@+id/editTextTextPersonName"
android:layout_width="162dp"
android:layout_height="48dp"
android:ems="10"
android:inputType="textPersonName"
android:text="Atharva Butte"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

<LinearLayout
android:layout_width="319dp"
android:layout_height="549dp"
android:layout_marginTop="112dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.63"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/img" />

<Button
android:onClick="b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:text="Clockwise / Anti Clockwise" />

<Button
android:onClick="b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:text="Zoom In / Out" />

<Button
android:onClick="b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:text="Fade In / Out" />
</LinearLayout>
</[Link]>

[Link]
package [Link].practical25;
import [Link];

import [Link];
import [Link];
import [Link].*;
import [Link];

public class MainActivity extends AppCompatActivity {


ImageView img;

@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
img = findViewById([Link]);

public void b1(View v) {


Animation rot = [Link](this, [Link]);
Animation ant_rot = [Link](this, [Link].anit_rotate);
[Link](new [Link]() {
@Override
public void onAnimationStart(Animation animation) { }

@Override
public void onAnimationEnd(Animation animation) {
[Link](ant_rot);
}

@Override
public void onAnimationRepeat(Animation animation) { }
});
[Link](rot);
}
public void b2(View v) {
Animation zom_in = [Link](this, [Link].zoom_in);
Animation zom_out = [Link](this, [Link].zoom_out);
zom_in.setAnimationListener(new [Link]() {
@Override
public void onAnimationStart(Animation animation) { }

@Override
public void onAnimationEnd(Animation animation) {
[Link](zom_out);
}

@Override
public void onAnimationRepeat(Animation animation) { }
});
[Link](zom_in);
}
public void b3(View v) {
Animation fad_in = [Link](this, [Link].fade_in);
Animation fad_out = [Link](this, [Link].fade_out);
fad_in.setAnimationListener(new [Link]() {
@Override
public void onAnimationStart(Animation animation) { }

@Override
public void onAnimationEnd(Animation animation) {
[Link](fad_out);
}

@Override
public void onAnimationRepeat(Animation animation) { }
});
[Link](fad_in);
}
}

Practical No 25 
Q1. 
activity_main.xml 
<?xml version="1.0" encoding="utf-8"?> 
<androidx.constraintlayout.widget.Constraint
import androidx.appcompat.app.AppCompatActivity; 
 
import android.os.Bundle; 
import android.view.View; 
import android.view

You might also like