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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:15:25+00:00 2026-06-16T10:15:25+00:00

I created a simple application. In my main activity class i use this to

  • 0

I created a simple application.
In my main activity class i use this to play a sound when a button is clicked

MediaPlayer buttonSound = MediaPlayer.create(this, R.drawable.button_sound); 

public void onClick(View arg0){
                buttonSound.start();
                             }

In my main activity class i have a service that start a background music

 Intent svc=new Intent(this, BackgroundSoundService.class);
 startService(svc);

The problem is that I can’t handle them (my background music and my button sound) with the volume buttons of my mobile.
If i decrease the volume of my mobile, my application volume doesn’t change!
what should I do?

  • 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-16T10:15:26+00:00Added an answer on June 16, 2026 at 10:15 am

    You can use AudioManager to control volumn of Media Player.

    // Get the AudioManager
    AudioManager audioManager =(AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
    // Set the volume of played media to your choice.
    audioManager.setStreamVolume (AudioManager.STREAM_MUSIC,10,0); 
    

    Also can use setVolume (float leftVolume, float rightVolume) for your media player as like as

    buttonSound.setVolume(10,10);
    

    Where
    Parameters
    leftVolume–> left volume scalar
    rightVolume–> right volume scalar

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

Sidebar

Related Questions

I created a simple application inspired by this example in order to test all
I simply created an application where when the button is clicked it shows a
I have a simple application, where I created a SurfaceView class, then in the
I have created one simple application using Android but this application crashes when I
I created a simple Sudoku application, where each 3x3 squares is a user control,
I've created a simple Flex application to fetch an XML file. I need a
I have created a simple blog application with Ruby on Rails. The applications consists
I've created a very simple Enterprise Application project with about 7 entity beans and
I have created a simple win 32 application..in which it has a textbox and
I've created a simple console Java application that is built with Maven. Is there

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.