Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (retired 2014) Pretty Little Things Animating the Answer

Khaled Yasser
Khaled Yasser
4,234 Points

when i click the button , the animation some times work and other times don't work, i guess my code is correct,any help?

i have animated my label with alpha animation , the problem is when i run my app , on some clicks the animation works , but other times it don't work , i think that my code is pretty similar to ben's code , i tried many things , but the problem still exists , any help ??

Luke O'Neill
Luke O'Neill
7,822 Points

Could you post some of your code please?

1 Answer

Khaled Yasser
Khaled Yasser
4,234 Points

private void animateAnswer(){ AlphaAnimation fadeInAnimation = new AlphaAnimation(0, 1); fadeInAnimation.setDuration(2000); fadeInAnimation.setFillAfter(true); mlabel.setAnimation(fadeInAnimation); } private void handleNewAnswer() { String myanswer= Crystalball.getanswer(); mlabel.setText(myanswer); animateAnswer(); playsound(); } and i just called handleNewAnswer in the shakedetector listener