Home Android Random Background Image with background sound
Reply: 0

Android Random Background Image with background sound

user753 Published in June 20, 2018, 12:02 am

I have an Activity that if opened, it displays random background.

I was wondering if having a background with sound is possible in android. Like if the background is Nature.jpg then the background audio is BirdsChirping.mp3. (So it matches the ambiance of the background.)

Like this:

> Nature.jpg = BirdsChirping.mp3 
> Ocean.jpg = Waves.mp3 
> Plane.jpg = JetEngineSound.mp3

Here is my current code:

    int[] photos={R.drawable.nature, R.drawable.ocean};
    ImageView image= (ImageView) findViewById(R.id.main_activity_bg);
    Random ran=new Random();
    int i=ran.nextInt(photos.length);
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.321808 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO