0

In my Android application, all my views are like this: https://i.stack.imgur.com/bcUdk.jpg (reuploaded)

I mean:

  • I have a LinearLayout with a background red color for my App Title;
  • 4 ImageButtons, when I click in each of them, I acess a specific view;
  • The content.

I'm debugging on my Samsung Galaxy S3. Everytime I click in a ImageButton (Menu1 - Menu4), the new Activity/View open, with a fadein effect (because my Galaxy S3, I guess) and It's working. But it's disturbing, the effect. I use some apps that I don't see the "fade in" effect every time I change the current view.

So: How can I start a new Intent without the "fadeIn" effect, because it's making a big history of views, everytime I click in one ImageButton, a new view open, with this boring effect.

I do the ImageButton actions like this:

Intent nextView = new Intent(v.getContext(), MainActivity.class);
startActivity(nextView);

The "FadeIn" is: https://www.youtube.com/watch?v=Zcfgn6kqFUI (1min 1sec), for example. Everytime I click the button my view open with this "effect".

Thanks!

Felipe M
  • 449
  • 1
  • 3
  • 14

1 Answers1

0

EDIT:

Try executing this code after the startActivity():

overridePendingTransition(0,0);

EDIT: Another way would be to set a specific style for your activity:

<item name="android:windowAnimationStyle">@null</item>

Source: Similar question

EDITEDIT:

You want to run only a single task of your activities. What you need to do is add android:launchMode="singleTask" to the activities that you want to be run only once inside your AndroidManifest.xml file.

<activity
    android:name=".Menu1"
    android:label="@string/app_name"
    android:launchMode="singleTask"
    ... />
Community
  • 1
  • 1
Simas
  • 43,548
  • 10
  • 88
  • 116
  • Hey, @user3249477, I think it's kinda working. The boring fadeIn effect is over. But is this a good way? – Felipe M Jul 07 '14 at 23:49
  • By the way, it's not "cleanning" the history. I mean, if I'm on Menu1, then go Menu2, then go Menu1, then go Menu2, then go Menu1, then go Menu2 if I press "back button" (on my device), I go back to Menu1, then press again and Menu2. I wanted to: back to Menu1 and back again: exit application. Any idea? – Felipe M Jul 07 '14 at 23:51
  • And please don't combine multiple questions. If this one was answered select the correct answer and ask another one. – Simas Jul 07 '14 at 23:59