Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7721525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:56:49+00:00 2026-06-01T03:56:49+00:00

I am a newbie to Android and currently learning the Android SDK. I am

  • 0

I am a newbie to Android and currently learning the Android SDK.

I am writing a very simple application that will just play various sounds upon interacting with widgets. I am using MediaPlayer to playback the sounds.

My question is should i use singleton pattern for MediaPlayer? I want just one object of MediaPlayer to be shared, but the confusion comes from the following link

https://developer.android.com/reference/android/media/MediaPlayer.html

which says that:

It is also recommended that once a MediaPlayer object is no longer
being used, call release() immediately so that resources used by the
internal player engine associated with the MediaPlayer object can be
released immediately. Resource may include singleton resources such as
hardware acceleration components and failure to call release() may
cause subsequent instances of MediaPlayer objects to fallback to
software implementations or fail altogether.

I don’t want to run MediaPlayer as service for now.

So what should i do? Should I use the Singleton Pattern for MediaPlayer?

Great Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:56:50+00:00Added an answer on June 1, 2026 at 3:56 am

    It is not advisable , as you can see from the extract, to keep an object of MediaPlayer as a singleton. Mainly because valuable resources such as hardware could be kept locked as long as you have a media player object in any of the states other than the END state. Also when you call release(), the object cannot be reused. You would need a new instance.
    I think the android team wants the developers to create objects when needed and release it when done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m currently working on a Android project and is very newbie to the Android
I am currently trying to write a very simple app that sends an object
I am newbie in android. I developed an android application that shows 15 tabs.
I'm rather newbie on Android, and I'm working on a simple application to get
I am a newbie in Android and currently I am designing an application where
I'm newbie in Android application development. I just downloaded all SDks and Eclispe. Then
Newbie question: I just installed VisualSVN Server and created a repository. I noticed that
I am an Android Newbie and I'm developing Go game application for android. I'm
Hi am newbie to android development. I had created one application where i need
I'm writing an Android app for work that shows the status of our phone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.