Jump to content
  • Advertisement
Sign in to follow this  
Anubiss

Animation - shakingProblem

This topic is 2393 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey guys.
following problem:

I want to let my startbutton shake if it is not touched within 10 seconds. this lecture is out of a book i baught for starting with Android programing. But although i am thinking of havin done everything correct, the button does not shake.

buttonID = button1

res/anim/wackeln.xml

<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="-40"
android:toDegrees="40"
android:duration="1000"
android:repeatCount="20" />



and in my main activity:


private Animation animationWackeln;
private Button startButton;
private Handler handler = new Handler();


public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(this);
animationWackeln = AnimationUtils.loadAnimation(this, R.anim.wackeln);
startButton = (Button)findViewById(R.id.button1);
}


private class WackleButton implements Runnable {

public void run() {
startButton.startAnimation(animationWackeln);
}
}

@Override

protected void onResume(){
super.onResume();
handler.postDelayed(new WackleButton(), 1000*10);
}


i hope someone will help. thank you

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!