Skip to content

Instantly share code, notes, and snippets.

@ljanzik
Created February 15, 2014 05:47
Show Gist options
  • Save ljanzik/9015047 to your computer and use it in GitHub Desktop.
Save ljanzik/9015047 to your computer and use it in GitHub Desktop.
Simple Demo for the usage of AspectJ
/**
* 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