本文整理了Java中android.app.Application.getClassLoader()
方法的一些代码示例,展示了Application.getClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.getClassLoader()
方法的具体详情如下:
包路径:android.app.Application
类名称:Application
方法名:getClassLoader
暂无
代码示例来源:origin: Tencent/tinker
@Override
public ClassLoader getClassLoader() {
ClassLoader classLoader = super.getClassLoader();
if (applicationLike != null) {
return invokeAppLikeGetClassLoader(applicationLike, classLoader);
}
return classLoader;
}
代码示例来源:origin: android-hacker/VirtualXposed
private void fixWeChatRecovery(Application app) {
try {
Field field = app.getClassLoader().loadClass("com.tencent.recovery.Recovery").getField("context");
field.setAccessible(true);
if (field.get(null) != null) {
return;
}
field.set(null, app.getBaseContext());
} catch (Throwable e) {
e.printStackTrace();
}
}
代码示例来源:origin: Tencent/tinker
final ClassLoader classLoader = appLike.getApplication().getClassLoader();
if (classLoader == null) {
TinkerLog.e(TAG, "classloader is null");
代码示例来源:origin: android-hacker/VirtualXposed
@Override
protected void onCreate(Bundle savedInstanceState) {
// The savedInstanceState's classLoader is not exist.
super.onCreate(null);
finish();
// It seems that we have conflict with the other Android-Plugin-Framework.
Intent stubIntent = getIntent();
// Try to acquire the actually component information.
StubActivityRecord r = new StubActivityRecord(stubIntent);
if (r.intent != null) {
if (TextUtils.equals(r.info.processName, VirtualRuntime.getProcessName()) && r.userId == VUserHandle.myUserId()) {
// Retry to inject the HCallback to instead of the exist one.
InvocationStubManager.getInstance().checkEnv(HCallbackStub.class);
Intent intent = r.intent;
intent.setExtrasClassLoader(VClientImpl.get().getCurrentApplication().getClassLoader());
startActivity(intent);
} else {
// Start the target Activity in other process.
VActivityManager.get().startActivity(r.intent, r.userId);
}
}
}
代码示例来源:origin: roomanl/AndroidDownload
@Override
public ClassLoader getClassLoader() {
Log.d(TAG,"----getBaseContext");
return app.getClassLoader();
}
代码示例来源:origin: bzsome/VirtualApp-x326
private void fixWeChatRecovery(Application app) {
try {
Field field = app.getClassLoader().loadClass("com.tencent.recovery.Recovery").getField("context");
field.setAccessible(true);
if (field.get(null) != null) {
return;
}
field.set(null, app.getBaseContext());
} catch (Throwable e) {
e.printStackTrace();
}
}
代码示例来源:origin: darkskygit/VirtualApp
private void fixWeChatRecovery(Application app) {
try {
Field field = app.getClassLoader().loadClass("com.tencent.recovery.Recovery").getField("context");
field.setAccessible(true);
if (field.get(null) != null) {
return;
}
field.set(null, app.getBaseContext());
} catch (Throwable e) {
e.printStackTrace();
}
}
代码示例来源:origin: Workday/postman
public static <T extends Parcelable> T writeAndReadParcelable(Parcelable in) {
Parcel parcel = Parcel.obtain();
parcel.writeParcelable(in, 0);
parcel.setDataPosition(0);
T value = parcel.readParcelable(RuntimeEnvironment.application.getClassLoader());
parcel.recycle();
return value;
}
}
代码示例来源:origin: darkskygit/VirtualApp
@Override
protected void onCreate(Bundle savedInstanceState) {
// The savedInstanceState's classLoader is not exist.
super.onCreate(null);
finish();
// It seems that we have conflict with the other Android-Plugin-Framework.
Intent stubIntent = getIntent();
// Try to acquire the actually component information.
StubActivityRecord r = new StubActivityRecord(stubIntent);
if (r.intent != null) {
if (TextUtils.equals(r.info.processName, VirtualRuntime.getProcessName()) && r.userId == VUserHandle.myUserId()) {
// Retry to inject the HCallback to instead of the exist one.
InvocationStubManager.getInstance().checkEnv(HCallbackStub.class);
Intent intent = r.intent;
intent.setExtrasClassLoader(VClientImpl.get().getCurrentApplication().getClassLoader());
startActivity(intent);
} else {
// Start the target Activity in other process.
VActivityManager.get().startActivity(r.intent, r.userId);
}
}
}
代码示例来源:origin: bzsome/VirtualApp-x326
@Override
protected void onCreate(Bundle savedInstanceState) {
// The savedInstanceState's classLoader is not exist.
super.onCreate(null);
finish();
// It seems that we have conflict with the other Android-Plugin-Framework.
Intent stubIntent = getIntent();
// Try to acquire the actually component information.
StubActivityRecord r = new StubActivityRecord(stubIntent);
if (r.intent != null) {
if (TextUtils.equals(r.info.processName, VirtualRuntime.getProcessName()) && r.userId == VUserHandle.myUserId()) {
// Retry to inject the HCallback to instead of the exist one.
InvocationStubManager.getInstance().checkEnv(HCallbackStub.class);
Intent intent = r.intent;
intent.setExtrasClassLoader(VClientImpl.get().getCurrentApplication().getClassLoader());
startActivity(intent);
} else {
// Start the target Activity in other process.
VActivityManager.get().startActivity(r.intent, r.userId);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!