android - this keyword as parameter to a new Intent -


from android documentation:

public intent (context packagecontext, class<?> cls) parameters packagecontext  context of application package implementing class. cls     component class used intent. 

correct me if wrong:

  1. a context of application package implementing class. means package contains class want start.
  2. this shouldn't work(but works, why?), because this refers current activity, not application package says in documentation.

a context of application package implementing class. means package contains class want start.

here, "application package", cases, is referring app.

this shouldn't work

yes, should.

this refers current activity, not application package says in documentation.

assuming current activity , activity started both in same app, this works fine, "a context of application package implementing class". this not work if trying start activity other app, in case use implicit intent pattern, using action string (e.g., action_view) instead of context , java class.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -