listener for a long time, first time caller ...
I am creating a splash screen derived from an Activity called SplashBase that fits inside a common project. The layout is as follows:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linlytSplash"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/imgvwSplash"
android:src="@drawable/splashscreen"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
></ImageView>
<LinearLayout
android:id="@+id/linlytProgress"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center"
>
<ProgressBar
android:id="@+id/progbarProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
></ProgressBar>
<TextView
android:id="@+id/txtvwProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:gravity="center_vertical"
android:text="@string/loading_ellipsis"
android:textStyle="bold"
></TextView>
</LinearLayout>
</LinearLayout>
I load the animation as follows:
Animation animation = AnimationUtils.loadAnimation(this, R.anim.splashscreen_anim);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
if (null != m_intentToLaunch) {
startActivity(m_intentToLaunch);
}
finish();
}
});
animation.setStartTime(AnimationUtils.currentAnimationTimeMillis() + 1000);
I have a Splash derived class that lives in my main project.
I had this screen saver for a long time, the animation always worked. My ImageView is displayed for 2 seconds, and then it animates and disappears before calling finish () and loading the next action.
Now I am adding a ProgressBar that only displays for the first second (not quite so, but clearer if I explain that). For some reason, after I hide the ProgressBar, the animation no longer works in ImageView. When i call
findViewById(R.id.linlytProgress).setVisibility(View.INVISIBLE);
. :
findViewById(R.id.txtvwProgress).setVisibility(View.INVISIBLE);
findViewById(R.id.progbarProgress).setVisibility(View.INVISIBLE);
TextView, , . ProgressBar, , ImageView . .