R
R
Riodevista2015-02-05 03:13:28
Android
Riodevista, 2015-02-05 03:13:28

How to overcome animation in an application on a device where it is disabled?

Hello!
The application has a MainActivity with an Action bar, which has a button that, when clicked, opens a new SecondActivity.
In this new SecondActivity with

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
the "up" button is set, when you click on it, you return to the MainActivity.
Android implements window transition animations by default. So when you return to MainActivity using the "up" button, the current window will expand and then disappear smoothly, that is, the transition between windows will be animated.
There is a device where the animation is disabled through the functions for developers. All applications work correctly. With my application, the situation is such that when the animation is disabled, it still remains in the transition between windows that I described, but at the same time it works quickly and without a smooth disappearance.
Question: Why is there animation? How to overcome it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Riodevista, 2015-02-06
@Riodevista

I solved the problem by refusing to automatically return to the parent activity specified in the manifest when the button is clicked.
Written manually:

public boolean onOptionsItemSelected(MenuItem item) {
        switch(item.getItemId()){
            case android.R.id.home:
                ...
                finish();
                return true;
        ...
        }
        return super.onOptionsItemSelected(item);
    }

Everything became good.
I don't know why things didn't work well when using android:parentActivityName in the manifest.

T
troffee, 2015-02-05
@troffee

it is necessary to register in the manifest, but honestly, I myself am a beginner and therefore I cannot register the code here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question