Skip to content

Commit

Permalink
use onResume to hold the latest context object
Browse files Browse the repository at this point in the history
  • Loading branch information
ollide committed Apr 20, 2015
1 parent 49801ad commit 9a552fc
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import android.os.Environment;
import android.view.MotionEvent;
import android.view.View;
Expand Down Expand Up @@ -53,8 +52,8 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
// hidden API use may fail
}

// hook BaseActivity's onCreate to gain access on a valid Context object
findAndHookMethod(ClassNames.getBaseActivityName(), loadPackageParam.classLoader, "onCreate", Bundle.class, new XC_MethodHook() {
// hook BaseActivity's onResume to gain access on a valid Context object
findAndHookMethod(ClassNames.getBaseActivityName(), loadPackageParam.classLoader, "onResume", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
mContext = (Context) param.thisObject;
Expand Down

0 comments on commit 9a552fc

Please sign in to comment.