本文整理了Java中android.os.Message.copyFrom()
方法的一些代码示例,展示了Message.copyFrom()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.copyFrom()
方法的具体详情如下:
包路径:android.os.Message
类名称:Message
方法名:copyFrom
暂无
代码示例来源:origin: robolectric/robolectric
@Test
public void testCopyFrom() throws Exception {
Bundle b = new Bundle();
Message m = new Message();
m.arg1 = 10;
m.arg2 = 42;
m.obj = "obj";
m.what = 24;
m.setData(b);
m.setTarget(new Handler());
Message m2 = new Message();
m2.copyFrom(m);
assertThat(m2.arg1).isEqualTo(m.arg1);
assertThat(m2.arg2).isEqualTo(m.arg2);
assertThat(m2.obj).isEqualTo(m.obj);
assertThat(m2.what).isEqualTo(m.what);
assertThat(m2.getTarget()).isNull();
assertThat(m2.getData()).isNotNull();
assertThat(m2.getData().isEmpty()).isTrue();
}
代码示例来源:origin: com.github.japgolly.android.test/robolectric
@Implementation
public static Message obtain(Message msg) {
Message m = new Message();
m.copyFrom(msg);
m.setTarget(msg.getTarget());
return m;
}
内容来源于网络,如有侵权,请联系作者删除!