Im reading a book "Pragmatics: Hello Android" and copy the code word for word and syntax is all correct because i get no errors but it does not do what i tell it to do on the onAnimationEnd.. it suppose to take me to my next activity but since that was not working i changed it to something simple like txtView.setText("ggag") just to see if it was even executing... and i noticed the way the book goes about it is slightly different..
Animation fadein = AnimationUtils.loadAnimation(this, R.anim.fade_in);
fadein.setAnimationListener(new AnimationListener() { /*im thinking the problem is
that it does all the work from within the setAnimationLIstener instead of like i
have seen around where the methods onAnimationEnd , onAnimationRepeat are all
done seprately outside of the
setAnimationListener(new AnimationListener() {..all work is done here??... } */
@Override
public void onAnimationEnd(Animation animation) {
//startActivity(new Intent(splahActivity.this,menuActivity.class));
//the above line of code was not working so i added the line below
//neither executes
TextView topLogo = (TextView)findViewById(R.id.lblTop);
topLogo.setText("dfsgsdfg");
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
});
so yeah my onAnimationEnd code is never execute开发者_JAVA技巧d :(
Did you call fadein.start()?
Does code (ex. log a message) in onAnimationStart() run?
I have the same problem, mine solved by adding activities tag in manifest.xml hope it works for you...
my manifest.xml file now is :
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidbook.triviaquiz7"
android:versionCode="1"
android:versionName="1.0">
<application
android:label="@string/app_name"
android:debuggable="true"
android:icon="@drawable/quizicon">
<activity
android:name=".QuizSplashActivity"
android:label="@string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".QuizGameActivity"></activity>
<activity
android:name=".QuizSettingsActivity"></activity>
<activity
android:name=".QuizScoresActivity"></activity>
<activity
android:name=".QuizHelpActivity"></activity>
<activity
android:name=".QuizMenuActivity"></activity>
</application>
<uses-sdk
android:minSdkVersion="7" />
</manifest>
I also put dot in the beginning of each activity name, that eliminate all errors
精彩评论