0

I got a weird problem with one of my Android app. I will explain myself :

  • I have a SplashScreen (sort of) which is an activity. Basically, it stays 1 second and after this time a handler is called. This handler launches my HomeActivity, which extends RoboActivity (Roboguice API).

  • During this launch, I see in my stack trace that Roboguice is initializing, and my class too. So it takes 1-2 seconds more to launch the HomeActivity (after the 1 second wait of the SplashScreen).

  • So basically, this is here that I got a problem. During this 1-2 seconds of loading, the SplashScreen is the one showing in front, and the HomeActivity only appears after this 2 seconds. If the user clicks, during these seconds, on the screen, it will be the HomeActivity that will trigger the event. It means that if you click on the SplashScreen, and you wait, when the HomeActivity will show, you will hear a click sound and the button, located where the user clicked, will trigger.

I find it very disturbing for the user. So, at the moment, I tried to :

  • Deactivate the buttons in the xml layout by adding

                android:enabled="false"
                android:clickable="false"
    
  • Reactivate the buttons by adding in the onResume function :

    button.setEnabled(true);
    button.setClickable(true);
    
  • I see in the stacktrace that the OnClickListener is triggered just after the onResume. So at this moment, the buttons are re-enabled and so it clicks. I tried with postOnResume too, it doesn't work either.

Did you experienced the same behavior that I have now ? Any idea how to fix it ?

Renjith
  • 5,783
  • 9
  • 31
  • 42
Olivier.G
  • 143
  • 1
  • 2
  • 12
  • How do you launch real home activity from your splashscreen? busy waiting in onRFesume() / onCreate() ? – Konstantin Pribluda Oct 05 '12 at 08:26
  • I use this to launch my home from the splash : Intent intent = new Intent(SplashActivity.this, HomeActivity.class); startActivity(intent); finish(); Yes there is some long instanciation on the onCreate method of my home (but I can't do it in a thread). – Olivier.G Oct 05 '12 at 09:05
  • Show surrounding code from your splash activity in question body - comments do not allow formatting – Konstantin Pribluda Oct 05 '12 at 09:12

0 Answers0