Jump to content

  • Log In with Google      Sign In   
  • Create Account


Animation - shakingProblem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Anubiss   Members   -  Reputation: 100

Like
0Likes
Like

Posted 27 March 2012 - 02:59 AM

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

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS