Example usage for android.os Message sendToTarget

List of usage examples for android.os Message sendToTarget

Introduction

In this page you can find the example usage for android.os Message sendToTarget.

Prototype

public void sendToTarget() 

Source Link

Document

Sends this Message to the Handler specified by #getTarget .

Usage

From source file:com.variable.demo.api.fragment.ClimaFragment.java

@Override
public void onClimaTemperatureUpdate(ClimaSensor clima, SensorReading<Float> temperature) {
    Message m = mHandler.obtainMessage(MessageConstants.MESSAGE_CLIMA_TEMPERATURE);
    m.getData().putFloat(MessageConstants.FLOAT_VALUE_KEY, temperature.getValue());
    // convert the UTF
    final Context thiscontext = this.getActivity();
    final DecimalFormat formatter = new DecimalFormat("0.00");
    final String serialnumOne = clima.getSerialNumber();
    final String serialnum = serialnumOne.replaceAll("[^\\u0000-\\uFFFF]", "");
    final String scann = formatter.format(temperature.getValue());
    String json = "temperature;" + serialnum + ";" + scann;

    // POST to variable dashboard
    Ion.getDefault(thiscontext).getConscryptMiddleware().enable(false);
    Ion.with(thiscontext).load(// w ww.  j  a va  2s  .  co  m
            "https://datadipity.com/clickslide/fleetplusdata.json?PHPSESSID=gae519f8k5humje0jqb195nob6&update&postparam[payload]="
                    + json)
            .setLogging("MyLogs", Log.DEBUG).asString().withResponse()
            .setCallback(new FutureCallback<Response<String>>() {
                @Override
                public void onCompleted(Exception e, Response<String> result) {
                    if (e == null) {
                        Log.i(TAG, "ION SENT MESSAGE WITH RESULT CODE: " + result.toString());
                    } else {
                        Log.i(TAG, "ION SENT MESSAGE WITH EXCEPTION");
                        e.printStackTrace();
                    }
                }
            });
    m.sendToTarget();
}

From source file:com.dzt.musicplay.player.AudioService.java

private void playIndex(int position) {
    Message message = Message.obtain(mPlayFileHandler);
    Bundle data = new Bundle();
    data.putInt("position", position);
    message.what = 2;//from w w  w . j  av  a2s.c o m
    message.setData(data);
    message.sendToTarget();
}

From source file:com.dzt.musicplay.player.AudioService.java

private void readMedia(String filePath, boolean noVideo) {
    Message message = Message.obtain(mPlayFileHandler);
    Bundle data = new Bundle();
    data.putString("filePath", filePath);
    data.putBoolean("noVideo", noVideo);
    message.what = 1;/*from  w w  w. j av  a  2s. co m*/
    message.setData(data);
    message.sendToTarget();
}

From source file:com.taobao.weex.bridge.WXBridgeManager.java

public void post(Runnable r, Object token) {
    if (mJSHandler == null) {
        return;//w  w w  . jav a  2s.c o m
    }

    Message m = Message.obtain(mJSHandler, WXThread.secure(r));
    m.obj = token;
    m.sendToTarget();
}

From source file:com.taobao.weex.bridge.WXBridgeManager.java

private void sendMessage(String instanceId, int what) {
    Message msg = Message.obtain(mJSHandler);
    msg.obj = instanceId;//w  w w .ja  va2  s.c  o m
    msg.what = what;
    msg.sendToTarget();
}

From source file:com.droid.app.fotobot.FotoBot.java

/**
 *  ?  ?/*  w  w  w .  j  a  v  a 2  s  . c o  m*/
 *
 * @param h   handler,   ??
 * @param str ? ??
 */
public void SendMessage(Handler h, String str) {

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

}

From source file:com.droid.app.fotobot.FotoBot.java

/**
 *  ?  ?//from  w w  w  .j  a  v a2  s  .c  om
 *
 * @param str ? ??
 */
public void SendMessage(String str) {

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

}

From source file:com.droid.app.fotobot.FotoBot.java

/**
 *  ?  ?//from  w  w  w.j  a  v  a  2s . c  o m
 *
 * @param str ? ??
 * @param status ?? ??
 */
public void SendMessage(String str, String status) {

    Message msg = Message.obtain(); // Creates an new Message instance
    msg.obj = str; // Put the string into Message, into "obj" field.
    msg_status = status;
    msg.setTarget(h); // Set the Handler
    msg.sendToTarget(); //Send the message

}

From source file:com.taobao.weex.bridge.WXBridgeManager.java

/**
 * Initialize JavaScript framework/* w  w  w.j a va 2 s.  c  o  m*/
 *
 * @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();
}

From source file:com.taobao.weex.bridge.WXBridgeManager.java

public void takeJSHeapSnapshot(String filename) {
    Message msg = mJSHandler.obtainMessage();
    msg.obj = filename;/*  ww w  .  ja va2  s . c  o m*/
    msg.what = WXJSBridgeMsgType.TAKE_HEAP_SNAPSHOT;
    msg.setTarget(mJSHandler);
    msg.sendToTarget();
}