Twitter Facebook Delicious Digg Stumbleupon Favorites More

Tuesday, 28 August 2018

background music android

 MediaPlayer mediaPlayer;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //To play background sound
        if (getInt("Sound", 0) == 0) {
            mediaPlayer = MediaPlayer.create(this, R.raw.abc);
            mediaPlayer.start();
            mediaPlayer.setLooping(true);
        }
    }
Share:

0 comments:

Post a Comment

Search This Blog

Popular Posts

Pages

how to make crores from 1 lakh in stock markets in 1 year

how to make crores from 1 lakh in stock markets in 1 year

Blogger Tutorials

Blogger Templates

Sample Text

Copyright © ANDROID TUTORIAL CODE | Powered by Blogger
Design by SimpleWpThemes | Blogger Theme by NewBloggerThemes.com & Distributed By Protemplateslab