android.app.Activity.attach()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(362)

本文整理了Java中android.app.Activity.attach()方法的一些代码示例,展示了Activity.attach()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.attach()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:attach

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[]{}));
}

相关文章

Activity类方法