4

I am confused how to start building an application like below.

Scenario: I have an image where two bells(bell-1,bell-2) hanging like pendulum.My purpose are-

  1. If i sweep bell-1,it will go right side and back to left side(what a pendulum does) and makes sound.
  2. If i sweep bell-2,it will do like bell-1.
  3. If i sweep bell-1 and bell-2, both bells will go left to right to left (like pendulum) and makes sound.

My question is : What is the best way to do an application like this which will support all android devices.

Any help like document,links or advice will be highly appreciated.

Michael Celey
  • 12,645
  • 6
  • 57
  • 62
Humayun Kabir
  • 561
  • 2
  • 13
  • 27

1 Answers1

2

I thinkg you have two major tasks.

  1. create a pendulam
  2. play multiple sounds

to create a pendulam you can see this project. To specify the animation from xml here is a key part

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
  android:fromDegrees="15"
  android:toDegrees="-15"
  android:pivotX="50%"
  android:pivotY="0%"
  android:duration="2000"
  android:repeatMode="reverse"
  android:repeatCount="-1"/>

And to play multiple sounds use SoundPool. You can find plenty of examples out there.

stinepike
  • 54,068
  • 14
  • 92
  • 112