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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:15:41+00:00 2026-06-15T21:15:41+00:00

Hi friends I have an issue with Android media player. It is working but

  • 0

Hi friends I have an issue with Android media player. It is working but when I change the screen orientation, control with media player is lost, that is initially I am able to pause and stop the song, but once the screen orientation changes the song continues but I am unable to pause or stop etc.
This is the code I tried (I put the song in raw folder)

setContentView(R.layout.activity_medial_player);
        mp = new MediaPlayer();
playPause = (Button)findViewById(R.id.buttonPlay);
        playPause.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mp.isPlaying()) {
                    if(mp!=null) {
                        System.out.println("*******");
                        mp.pause();
                    }
                } else {
                    if(mp!=null) {
                        System.out.println("#######");
                        mp.start();
                    }
                }
            }
        });

startSong= (Button)findViewById(R.id.buttonStart);
        pause.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//              mp.pause();
                playSong();
            }
        });

stop = (Button)findViewById(R.id.buttonStop);
        stop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mp.stop();
            }
        });
}


public void playSong() {
        try {
            mp.reset();
            mp = MediaPlayer.create(MedialPlayer.this, resId);
            mp.start();
        } catch(Exception e) {

        }
    }

In Manifest I use:

android:configChanges="orientation|keyboard|keyboardHidden"

Any help please…

  • 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-15T21:15:42+00:00Added an answer on June 15, 2026 at 9:15 pm

    What is your API level ?

    If your application targets API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), then you should also declare the “screenSize” configuration, because it also changes when a device switches between portrait and landscape orientations.

    android:configChanges="orientation|screenSize|keyboard|keyboardHidden"
    

    Source : http://developer.android.com/guide/topics/manifest/activity-element.html

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

Sidebar

Related Questions

friends, i am facing an issue related to android phone screen orientation If i
My friends, I have an issue that I hope you can help me. So..Here
This issue may have be raised here before, but I am not confident that
I have an Android game that includes a screen that lists all ongoing games,
Hello friends I have tried many times but I am not successful than please
I have a working WAMP environment (Apache Friends). I decided to try Subversion and
I have created an invite friends code, which is properly working if an FB
I am working on an android application. In my app i have to open
Hello friends I have an issue adding a special class to a couple of
Hello friends a newbie question... The Issue is like this: I have a static

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.