Created
February 15, 2014 05:47
-
-
Save ljanzik/9015047 to your computer and use it in GitHub Desktop.
Simple Demo for the usage of AspectJ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* log before an activity is created | |
* | |
* @param joinPoint aspectj JoinPoint | |
*/ | |
@Before("execution(* android.app.Activity.onCreate())") | |
public void logActivityCreated(final JoinPoint joinPoint) { | |
Log.d(TAG, "Creating Activity: " + joinPoint.getTarget().getClass().getSimpleName()); | |
} | |
/** | |
* track after an activity is created | |
* | |
* @param joinPoint aspectj JoinPoint | |
*/ | |
@After("execution(* android.app.Activity.onCreate())") | |
public void trackActivityCreated(final JoinPoint joinPoint) { | |
Activity activity = (Activity) joinPoint.getTarget(); | |
EasyTracker.getInstance(activity).activityStart(activity); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment