cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Bowser <bows...@gmail.com>
Subject Re: onResume() of CordovaActivity
Date Thu, 18 Sep 2014 20:42:26 GMT
The purpose of this code is because when you start an app, onResume is
called, even though you didn't pause anything.  You aren't receiving any
results, and you're not restoring any multi-tasking state.  There is no
state, because you just started the application.  If you were to not have
this, it's possible that there's not a view to request focus, and of
course, this would fail:

        // Force window to have focus, so application always

        // receive user input. Workaround for some devices (Samsung Galaxy
Note 3 at least)

        this.getWindow().getDecorView().requestFocus();

The state tracking is directly related to starting and stopping the app.

On Thu, Sep 18, 2014 at 1:08 PM, Archana Naik <naik.archana@gmail.com>
wrote:

> Hi, Joe
>
> I have a question about a piece of code which has always been there in
> CordovaActivitie's onResume().
>
>  if (this.activityState == ACTIVITY_STARTING) {
>
>             this.activityState = ACTIVITY_RUNNING;
>
>             return;
>
>  }
>
>
> Do you know why we have this?
>
> Archana
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message