0% found this document useful (0 votes)
113 views7 pages

Android: Multimedia, Animation and Graphics: Syllabus: Playing Audio, Playing Video, Rotate Animation

The document discusses various multimedia and animation features in Android including playing audio and video, and different types of animations like rotate, fade, zoom, and scale animations. It provides an example of how to use the MediaPlayer class to play audio files and controls. It also discusses using MediaController and VideoView classes to play video files. Finally, it mentions that Android provides animation classes in the android.animation package to change object properties and behaviors at runtime, and AnimationDrawable can be used for time-based animations.

Uploaded by

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

Android: Multimedia, Animation and Graphics: Syllabus: Playing Audio, Playing Video, Rotate Animation

The document discusses various multimedia and animation features in Android including playing audio and video, and different types of animations like rotate, fade, zoom, and scale animations. It provides an example of how to use the MediaPlayer class to play audio files and controls. It also discusses using MediaController and VideoView classes to play video files. Finally, it mentions that Android provides animation classes in the android.animation package to change object properties and behaviors at runtime, and AnimationDrawable can be used for time-based animations.

Uploaded by

vishesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Android : Multimedia, Animation

and Graphics
https://www.javatpoint.com/

Syllabus : Playing Audio, Playing Video, Rotate Animation,


FadeIn/FadeOut Animation, Zoom Animation, Scale
Animation, 2D and 3D Graphics.
Media Player
• Play and control the audio files in android by
the help of MediaPlayer class.
• MediaPlayer class
• The android.media.MediaPlayer class is used
to control the audio or video files.
• Methods of MediaPlayer class
There are many methods of MediaPlayer class. Some of them are as follows:
package com.example.audioplay;
import android.media.MediaPlayer; try{
import android.os.Bundle; //you can change the path, here path
import android.os.Environment; is external directory(e.g. sdcard) /Music/maine
import android.app.Activity; .mp3
import android.view.Menu; mp.setDataSource(Environment.getExtern
import android.view.View; alStorageDirectory().getPath()+"/Music/maine.
import android.view.View.OnClickListener; mp3");
import android.widget.Button; mp.prepare();
public class MainActivity extends Activity { }catch(Exception e){e.printStackTrace();}
Button start,pause,stop; start.setOnClickListener(new OnClickListen
@Override er() {
protected void onCreate(Bundle savedInstan @Override
ceState) { public void onClick(View v) {
super.onCreate(savedInstanceState); mp.start();
setContentView(R.layout.activity_main); }
});
start=(Button)findViewById(R.id.button1); pause.setOnClickListener(new OnClickList
ener() {
pause=(Button)findViewById(R.id.button2) @Override
; public void onClick(View v) {
stop=(Button)findViewById(R.id.button3); mp.pause();
//creating media player }
final MediaPlayer mp=new MediaPlayer(); });
stop.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mp.stop();
}
});
} }

Android Video Player Example


• By the help of MediaController and VideoView classes, we can play the video files in android.
• MediaController class
• The android.widget.MediaController is a view that contains media controls like play/pause,
previous, next, fast-forward, rewind etc.
Android Animation Example

• Android provides a large number of classes and


interface for the animation development. Most of the
classes and interfaces are given
in android.animation package.
• Android Animation enables you to change the object
property and behavior at run time. There are various
ways to do animation in android.
• The AnimationDrawable class provides methods to
start and end the animation. Even, you can use time
based animation.
• Let's have a look at the simple example of android
animation.

You might also like