4

I am wondering if its at all possible to cancel ALL animation when starting an singleInstance activity, i am already using

@Override
public void onStop() {
    super.onStop();
    overridePendingTransition(0, 0);
}

@Override
public void onResume() {
    super.onResume();
    overridePendingTransition(0, 0);
}

for when finish is called and

    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

to activate it... but theres still a black screen ( short loading one). trying creating a costume Theme and didnt cancel it.

i kinda gave up hope... I know fragments will solve it. is there any way without?

SparK
  • 5,181
  • 2
  • 23
  • 32
Jony-Y
  • 1,579
  • 1
  • 13
  • 30

1 Answers1

2

Have you tried calling overridePendingTransition after calling startActivity(...)

You can also disable animations via themes

Developer should create a style,

<style name="noAnimTheme" parent="android:Theme">
  <item name="android:windowAnimationStyle">@null</item>
</style>

then in manifest set it as theme for activity or whole application.

<activity android:name=".ui.ArticlesActivity" android:theme="@style/noAnimTheme">
</activity>

You can also specify a style to specify custom entry and exit animations, so you can make it do what you like as well http://developer.android.com/reference/android/R.attr.html#windowEnterAnimation

James Campbell
  • 3,511
  • 4
  • 33
  • 50
  • yes man...i tried creating a no theme and then onCreate adding the theme.(There must be a theme in the Activity),so i tried both solutions...maybe I didnt explain it well enough in the question... – Jony-Y Oct 09 '13 at 05:13
  • Try using the XML above to apply it to the activity using the XML above in your manifest. The android:name must be named after your activity including the package path. – James Campbell Oct 09 '13 at 11:35
  • Did you try it? does it work for you? because when i tried it (still using it) canceling animation and theme and then on create creating a theme programmatically still i got a dark screen while loading...for 500ms or so... but its there – Jony-Y Oct 09 '13 at 13:24
  • It works for me but I'm wondering if it's to do with manufacturers installing their own skin on top, which version of Android / Device are you testing on ? You could try making your own animation via `windowEnterAnimation` which makes it instantly appear ? See http://developer.android.com/reference/android/R.attr.html#windowEnterAnimation or you can watch this https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDIQtwIwAA&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DHo8vk61lVIU&ei=s3tVUvKAI_Sr0AX944D4DA&usg=AFQjCNEYV4MHlDjCwm0ypc1d1XPlTJZZOg&bvm=bv.53760139,d.d2k – James Campbell Oct 09 '13 at 15:52