Reputation: 428
I'm trying to animate the TextView which is within the Custom Dialog Box. I dont want to animate the Dialog box, I have searched but all i found is Animate the Dialog box, not item in it.
TextView txt=(TextView) findViewById(R.id.textView1);
Animation mAnimation = new TranslateAnimation(0, 599, 0, 0);
mAnimation.setDuration(10000);
mAnimation.setFillAfter(true);
mAnimation.setRepeatCount(-1);
mAnimation.setRepeatMode(Animation.REVERSE);
txt.setAnimation(mAnimation);
I'm able to Animate the TextView with this code in the Layout which is not a dialog box, i am also able to Show the Text in the Dialog box, But i want to Animate the Text in the Dialog Box, when i run the code, i get Unfortunately, App has Stopped
Any help, I tried the onCreateDialog function, but got that its Deprecated.
Upvotes: 0
Views: 529
Reputation: 5322
You should make your TextView
instance refer to the one inside the Dialog:
TextView txt=(TextView) dialog.findViewById(R.id.textView1);
What you are doing is searching for in the main Layout
and it may not exist, so your App exits
Upvotes: 1