Mobile Application Development (22617)
Name : Ashwin Pawar Practical No : 25
Roll No : 23
Develop a program for animation. a program to build Ca Develop
a program for providing Bluetooth connectivity.
X. Exercise.
1. Write a program to rotate the image in
clockwise/anticlockwise, Zoom IN/Zoom OUT, Fade
IN/Fade OUT by using the following
[Link] file
Pr25java file
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class pr25 extends AppCompatActivity {
private ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_pr25);
imageView = findViewById([Link]);
Button rotateClockwiseButton =
findViewById([Link]);
[Link](new [Link]()
{
@Override
public void onClick(View v) {
rotateClockwise();
}
});
Button rotateAntiClockwiseButton =
findViewById([Link]);
[Link](new
[Link]() {
@Override
public void onClick(View v) {
rotateAntiClockwise();
}
});
Mobile Application Development (22617)
Button zoomInButton = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
zoomIn();
}
});
Button zoomOutButton = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
zoomOut();
}
});
Button fadeInButton = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
fadeIn();
}
});
Button fadeOutButton = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
fadeOut();
}
});
}
private void rotateClockwise() {
[Link]([Link]() - 90);
}
private void rotateAntiClockwise() {
[Link]([Link]() + 90);
}
private void zoomIn() {
[Link]([Link]() * 1.5f);
[Link]([Link]() * 1.5f);
}
private void zoomOut() {
[Link]([Link]() * 0.5f);
[Link]([Link]() * 0.5f);
}
private void fadeIn() {
[Link]().alpha(1).setDuration(1000);
}
private void fadeOut() {
[Link]().alpha(0).setDuration(1000);
}
}
Mobile Application Development (22617)
[Link] file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".pr25">
<ImageView
android:id="@+id/imageView"
android:layout_width="300dp"
android:layout_height="300dp"
android:src="@drawable/animation" />
<Button
android:id="@+id/rotateClockwiseButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Rotate Clockwise"
android:layout_below="@id/imageView"
android:layout_marginTop="40dp"/>
<Button
android:id="@+id/rotateAntiClockwiseButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Rotate Anti-clockwise"
android:layout_below="@id/rotateClockwiseButton"
android:layout_marginTop="10dp"/>
<Button
android:id="@+id/zoomInButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Zoom In"
android:layout_below="@id/rotateAntiClockwiseButton"
android:layout_marginTop="10dp"/>
<Button
android:id="@+id/zoomOutButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Zoom Out"
android:layout_below="@id/zoomInButton"
android:layout_marginTop="10dp"/>
<Button
android:id="@+id/fadeInButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fade In"
android:layout_below="@id/zoomOutButton"
android:layout_marginTop="10dp"/>
<Button
android:id="@+id/fadeOutButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fade Out"
android:layout_below="@id/fadeInButton"
android:layout_marginTop="10dp"/>
</RelativeLayout>
Mobile Application Development (22617)