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 8771843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:53:32+00:00 2026-06-13T17:53:32+00:00

I would like to use two soundpools in my activity. One that I will

  • 0

I would like to use two soundpools in my activity. One that I will unload and release sometimes and load it with different sounds, then I unload/release again and use it again with other sounds, and another one that will always contain the same sounds and will never be unloaded. I didnt find any words about this in the documentation, so will it cause me any kind of problem?
And if I use the constant sounds with MediaPlayer instead of SoundPool? Will it cause any memory leak or problem?

  • 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-13T17:53:33+00:00Added an answer on June 13, 2026 at 5:53 pm

    There will be no memory leaks or sound playback issues, if you correctly handle your SoundPool and MediaPlayer objects in terms of your Activity lifecycle (see below).

    First of all, you shouldn’t make “too many” SoundPool and MediaPlayer objects. This depends on the actual state of your device, but I’m sure you’ll be OK with 2 SoundPool objects and e.g. 4 MediaPlayer objects, simultaneously.

    Explanation: each SoundPool reserves one native AudioTrack, and each MediaPlayer also reserves one native AudioTrack. Therefore, with 2 SoundPool and 4 MediaPlayer objects, you will have 6 underlying AudioTrack objects in use. This is usually fine, as the system usually has many more free AudioTrack objects. (For more detailed information, see this topic.)

    Regarding your concrete question: yes, it’s also OK to use a permanent SoundPool and another SoundPool which you recreate/release sometimes, as long as you take into account the following point:

    • In the onPause() or onStop() event handler of your activity, you should release all SoundPool and MediaPlayer objects, because they use native resources. Then in your onResume() or onStart(), you can recreate them again. So your statement “… will never be unloaded” isn’t correct in this sense, because you need to handle the state of SoundPool and MediaPlayer objects across your Activity lifecycle.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one def function that I would like to use to handle two
I would like to use two different implementations for a DAO with Spring's testframework.
I would like to use two different insert statements with two different tables such
I would like to use two svn repositories. One is to synchronize with my
I have for example: $('#field').click(function(){ alert('One'); alert('Two'); }) and i would like use trigger:
I would like to use two models: User: - firstname : stringField - lastname
I would like to use a UISegmentedControl with two buttons as a replacement for
I would like to use CSS to present a two-column layout. The markup I
I am trying to use two different string functions (initcap and trim) on one
I would like to use UIGestureRecognizers to distinguish between two kinds of gestures: those

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.