本文整理了Java中android.app.Activity.attach()
方法的一些代码示例,展示了Activity.attach()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.attach()
方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:attach
暂无
代码示例来源:origin: stackoverflow.com
public Activity newActivity(Class<?> clazz, Context context,
IBinder token, Application application, Intent intent, ActivityInfo info,
CharSequence title, Activity parent, String id,
Object lastNonConfigurationInstance) throws InstantiationException,
IllegalAccessException {
Activity activity = (Activity)clazz.newInstance();
ActivityThread aThread = null;
activity.attach(context, aThread, this, token, 0, application, intent,
info, title, parent, id,
(Activity.NonConfigurationInstances)lastNonConfigurationInstance,
new Configuration(), null, null);
return activity;
}
代码示例来源:origin: stackoverflow.com
Activity activity = (Activity)clazz.newInstance();
ActivityThread aThread = null;
activity.attach(context, aThread, this, token, application, intent, info, title,
parent, id, lastNonConfigurationInstance, new Configuration());
return activity;
代码示例来源:origin: uPhyca/GAlette
@Test
public void weaveFragment() throws Exception {
// Process classes.
processClass("com.uphyca.galette.GAletteInstrumentationTest$TestFragmentClass");
// Load instrumented classes.
TestFragmentClass instrumentedObject = new TestFragmentClass();
Application app = new Application();
Activity activity = new Activity();
activity.attach(app);
instrumentedObject.setActivity(activity);
// Invoke method.
instrumentedObject.click();
// Verify interactions.
Method method = instrumentedObject.getClass().getDeclaredMethod("click", new Class[]{});
verify(galette).sendEvent(eq(instrumentedObject), eq(app), eq(method), eq(new Object[]{}));
}
内容来源于网络,如有侵权,请联系作者删除!