请求帮助从普通class调用Activity的conetxt
写了一个Xposed小程序,因版本原因无法使用system.loadlibray方法,碰巧在网上看到了ReLinker可以loadlibray,我已经完成界面显示,可以正常使用,但是XPosed只有普通Class,原本系统方法是system.loadlibray(string),但是Relinker使用Relinker.loadlibray(context, string),试了好多方法都无法得到MainActivity的Context,请教大神有什么方法可以使用? code:MainActivity
import android.app.Activity;
import android.content.Context;
import java.lang.reflect.Method;
import android.content.Intent;
import android.os.Bundle;
public class MainActivity extends Activity {
private File mLibDir;
private File mWorkaroundDir;
private EditText version;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
protected void onResume() {
super.onResume();
mLibDir = new File(getApplicationInfo().nativeLibraryDir);
mWorkaroundDir = getDir("lib", Context.MODE_PRIVATE);
updateTree();
findViewById(R.id.call).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String number = "**"
call(number);
}
});
private void call(String num) {
ReLinker.loadLibrary(MainActivity.this, "phoneloc-jni");
((TextView) findViewById(R.id.tree)).setText(builder.toString());
}
}
other class
public class SmartDialXposed implements IXposedHookLoadPackage {
String result ="";
String location = "";
String wife = "761";
String number = "";
public String compare(String num) {
ReLinker.loader(context, "phoneloc-jni");
// i want loadlibrary in here, need context, how to write code?
}
}
页:
[1]