Hi!

How can we detect if an Activity is run for the 1st time? I mean, it's
run just after the user clicked on the icon in the homescreen and not
after some event like screen rotation?

For instance:

public class Incoming extends Activity {
        private boolean firstrun=true;

        @Override
        public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);

            if (firstrun) {  // This is always run
                firstrun=false;
                ... do some heavy work (import a database from the
web, etc)
            }

The variable firstrun is always true. I've tried to change the
firstrun value in onResume but it's called after and not before
onCreate.

Is there a simple way to do this or will I have to resort to capture
screen orientation using onConfigurationChange?

Thanks in advance!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to