android.os.Message.setTarget()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(438)

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

Message.setTarget介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

} finally {
  Message msg = Message.obtain();
  msg.setTarget(handler);
  if (result != null) {
    msg.what = 1;

代码示例来源:origin: robolectric/robolectric

@Test
public void testGetTarget() throws Exception {
 Message m = new Message();
 Handler h = new Handler();
 m.setTarget(h);
 assertThat(m.getTarget()).isEqualTo(h);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testObtainWithMessage() 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 = Message.obtain(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()).isEqualTo(m.getTarget());
 assertThat(m2.getData()).isNotNull();
 assertThat(m2.getData().isEmpty()).isTrue();
}

代码示例来源: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: stackoverflow.com

// ....
String message = "linkSpeed = " + linkSpeed;
Message msg = Message.obtain(); // Creates an new Message instance
msg.obj = message; // Put the string into Message, into "obj" field.
msg.setTarget(handler); // Set the Handler
msg.sendToTarget(); //Send the message
//....

代码示例来源:origin: weexteam/weex-hackernews

/**
 * Initialize JavaScript framework
 * @param framework String representation of the framework to be init.
 */
public synchronized void initScriptsFramework(String framework) {
 Message msg = mJSHandler.obtainMessage();
 msg.obj = framework;
 msg.what = WXJSBridgeMsgType.INIT_FRAMEWORK;
 msg.setTarget(mJSHandler);
 msg.sendToTarget();
}

代码示例来源:origin: namndbka/QDict

public static void lookupProgressCB(int progress) {
  Message m = Message.obtain();
  m.arg1 = progress;
  m.setTarget(mProgressCBHandler);
  m.sendToTarget();
}

代码示例来源:origin: org.robolectric/shadows-core

@Implementation
 public void send(Message message) throws RemoteException {
  message.setTarget(handler);
  message.sendToTarget();
 }
}

代码示例来源:origin: com.github.japgolly.android.test/robolectric

@Implementation
  public void send(Message message) throws RemoteException {
    message.setTarget(handler);
    message.sendToTarget();
  }
}

代码示例来源:origin: org.robolectric/framework

@Implementation
 public void send(Message message) throws RemoteException {
  message.setTarget(handler);
  message.sendToTarget();
 }
}

代码示例来源:origin: org.robolectric/shadows-core-v23

@Implementation
 public void send(Message message) throws RemoteException {
  message.setTarget(handler);
  message.sendToTarget();
 }
}

代码示例来源:origin: com.github.japgolly.android.test/robolectric

@Implementation
public Message obtainMessage(int what, int arg1, int arg2, Object obj) {
  Message message = new Message();
  message.what = what;
  message.arg1 = arg1;
  message.arg2 = arg2;
  message.obj = obj;
  message.setTarget(realHandler);
  return message;
}

代码示例来源:origin: com.github.japgolly.android.test/robolectric

@Implementation
public static Message obtain(Handler h) {
  Message m = new Message();
  m.setTarget(h);
  return m;
}

代码示例来源: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;
}

代码示例来源:origin: stackoverflow.com

msg.setTarget(handler);

代码示例来源:origin: stackoverflow.com

} finally {
  Message message = Message.obtain();
  message.setTarget(handler);
  if (result != null) {
    message.what = 1;

代码示例来源:origin: stackoverflow.com

} finally {
  Message msg = Message.obtain();
  msg.setTarget(handler);
  if (result != null) {
    msg.what = 1;

相关文章