ConfirmationActivity Android Wear lasts too long

I have a wearable function that has a button. When the button is pressed, the following method is executed:

   public void success(View view) {
        Intent intent = new Intent(this, ConfirmationActivity.class);
        intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE,
                ConfirmationActivity.SUCCESS_ANIMATION);
        intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, "Success!");
        startActivity(intent);
        finish();
    }

      

A confirmation animation will appear, but for a few seconds. When I include the finish () line to close the current activity, it is even shorter ... Any ideas on how to show confirmation for a longer time? Or any other way to complete the current activity that will extend the confirmation for longer?

Thank!

+3


source to share


2 answers


The animation confirmation is handled by the OS, so I don't think you can change the duration.

There ConfirmationActivity

is a private member variable inside the class private static final long SUCCESS_MESSAGE_DELAY_MS = 50L;

However, this variable is private, so you cannot change it. Also, this variable is used to delay the appearance of an acknowledgment, so it is not useful for duration. It private static long getAnimationDuration(android.graphics.drawable.AnimationDrawable animation)

is also closed, so you don't even have to know how long the animation is exactly.



When you call finish () on an activity, you will simply indicate to the OS that your current activity is about to end. This will not help you to extend the lifespan. Your current activity will eventually be shown after the confirmation animation completes.

+3


source


I fought the same thing as you. There is no way to change the length of an animation, but you can turn off animations for an activity, which allows it to take longer. Now it looks really good!



intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

      

0


source







All Articles