to top
Android APIs
public class

Ringtone

extends Object
java.lang.Object
   ↳ android.media.Ringtone

Class Overview

Ringtone provides a quick method for playing a ringtone, notification, or other similar types of sounds.

For ways of retrieving Ringtone objects or to show a ringtone picker, see RingtoneManager.

See Also

Summary

Public Methods

? Examples
int getStreamType()
Gets the stream type where this ringtone will be played.

? Examples
String getTitle( Context context)
Returns a human-presentable title for ringtone.

? Examples
boolean isPlaying()
Whether this ringtone is currently playing.

? Examples
void play()
Plays the ringtone.

? Examples
void setStreamType(int streamType)
Sets the stream type where this ringtone will be played.

? Examples
void stop()
Stops a playing ringtone.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public int getStreamType ()

Added in API level 1

Gets the stream type where this ringtone will be played.

Returns

public String getTitle (Context context)

Added in API level 1

Returns a human-presentable title for ringtone. Looks in media and DRM content providers. If not in either, uses the filename

Parameters
context A context used for querying.

public boolean isPlaying ()

Added in API level 1

Whether this ringtone is currently playing.

Returns
  • True if playing, false otherwise.

public void play ()

Added in API level 1

Plays the ringtone.

public void setStreamType (int streamType)

Added in API level 1

Sets the stream type where this ringtone will be played.

Parameters
streamType The stream, see AudioManager.

public void stop ()

Added in API level 1

Stops a playing ringtone.

No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.