Example usage for android.os Message obtain

List of usage examples for android.os Message obtain

Introduction

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

Prototype

public static Message obtain() 

Source Link

Document

Return a new Message instance from the global pool.

Usage

From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java

public void GetGoodsPropertyList(final String goodsid) {
    new Thread() {
        Message msg = Message.obtain();

        @Override//from   w ww.j a  v a  2  s.  com
        public void run() {
            String data = "&goodsid=" + goodsid;
            Log.e("data=", data);
            String result_data = NetUtil.getResponse(WebAddress.GetGoodsPropertyList, data);
            Log.e("result_data=", result_data);
            try {
                JSONObject jsonObject = new JSONObject(result_data);
                msg.what = CommunalInterfaces.GetGoodsPropertyList;
                msg.obj = jsonObject;
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                handler.sendMessage(msg);
            }
        }
    }.start();
}

From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java

public void SendChatData(final String receive_uid, final String content) {
    new Thread() {
        Message msg = Message.obtain();

        @Override/*from  w  w w  .j  av a  2 s  .c om*/
        public void run() {
            String data = "&send_uid=" + user.getUserId() + "&receive_uid=" + receive_uid + "&content="
                    + content;
            Log.e("data=", data);
            String result_data = NetUtil.getResponse(WebAddress.SendChatData, data);
            Log.e("result_data=", result_data);
            try {
                JSONObject jsonObject = new JSONObject(result_data);
                msg.what = CommunalInterfaces.SendChatData;
                msg.obj = jsonObject;
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                handler.sendMessage(msg);
            }
        }
    }.start();
}

From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java

public void xcGetChatData(final String receive_uid, final String beginid) {
    new Thread() {
        Message msg = Message.obtain();

        @Override/*from  w w w  . j  a  v  a  2  s. c  o m*/
        public void run() {
            String data = "&send_uid=" + user.getUserId() + "&receive_uid=" + receive_uid + "&beginid="
                    + beginid;
            Log.e("data=", data);
            String result_data = NetUtil.getResponse(WebAddress.xcGetChatData, data);
            Log.e("result_data=", result_data);
            try {
                JSONObject jsonObject = new JSONObject(result_data);
                msg.what = CommunalInterfaces.xcGetChatData;
                msg.obj = jsonObject;
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                handler.sendMessage(msg);
            }
        }
    }.start();
}

From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java

public void xcGetChatListData() {
    new Thread() {
        Message msg = Message.obtain();

        @Override// www  . j  ava2  s .  com
        public void run() {
            String data = "&uid=" + user.getUserId();
            Log.e("data=", data);
            String result_data = NetUtil.getResponse(WebAddress.xcGetChatListData, data);
            Log.e("result_data=", result_data);
            try {
                JSONObject jsonObject = new JSONObject(result_data);
                msg.what = CommunalInterfaces.xcGetChatListData;
                msg.obj = jsonObject;
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                handler.sendMessage(msg);
            }
        }
    }.start();
}

From source file:com.xclong.vehiclemonitordemo.service.CommunicationService.java

public void sendHandlerMessage(String str, int i) {
    Message msg = Message.obtain();
    msg.what = 1;/* w w  w .  j a  va2 s  .c  o  m*/
    switch (i) {
    case 0:
        str = "send : " + str;
        break;
    case 1:
        str = "recv : " + str;
        break;
    case 2:
        str = "tips : " + str;
        break;
    }
    msg.obj = str;
    UpgradeFragment.newInstance().getHandler().sendMessage(msg);
}

From source file:com.xclong.vehiclemonitordemo.service.CommunicationService.java

public void sendHandlerMessage(int i, int j) {
    Message msg = Message.obtain();
    switch (i) {/*from w  w  w .java  2  s. co m*/
    case 2:
        msg.what = 2;
        break;
    case 3:
        msg.what = 3;
        break;
    }
    msg.obj = j;
    UpgradeFragment.newInstance().getHandler().sendMessage(msg);
}

From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java

public void GetMyWallet() {
    new Thread() {
        Message msg = Message.obtain();

        @Override/*from w ww.  java 2s.  co  m*/
        public void run() {
            String data = "&userid=" + user.getUserId();
            Log.e("data=", data);
            String result_data = NetUtil.getResponse(WebAddress.GetMyWallet, data);
            Log.e("result_data=", result_data);
            try {
                JSONObject jsonObject = new JSONObject(result_data);
                msg.what = CommunalInterfaces.GetMyWallet;
                msg.obj = jsonObject;
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                handler.sendMessage(msg);
            }
        }
    }.start();
}

From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java

public void bindWeChat(final String userId, final String weChatId) {
    new Thread() {
        Message msg = Message.obtain();

        @Override//from w w  w  .  j  av  a2  s .  c  o m
        public void run() {
            String data = "&userid=" + userId + "&weixin=" + weChatId;
            String result_data = NetUtil.getResponse(WebAddress.BIND_WECHAT_AND_USERID, data);
            try {
                JSONObject jsonObject = new JSONObject(result_data);
                msg.what = CommunalInterfaces.BIND_WECHAT_AND_USERID;
                msg.obj = jsonObject;
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                handler.sendMessage(msg);
            }
        }
    }.start();
}

From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java

public void checkWeChatBind(final String weChatId) {
    new Thread() {
        Message msg = Message.obtain();

        @Override//from www .  j  av a 2 s .  co m
        public void run() {
            String data = "&weixin=" + weChatId;
            String result_data = NetUtil.getResponse(WebAddress.CHECK_WECHAT_BIND, data);
            try {
                JSONObject jsonObject = new JSONObject(result_data);
                msg.what = CommunalInterfaces.CHECK_WECHAT_BIND;
                msg.obj = jsonObject;
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                handler.sendMessage(msg);
            }
        }
    }.start();
}

From source file:cn.xiaocool.android_etong.net.constant.request.MainRequest.java

public void GetUserBankInfo() {
    new Thread() {
        Message msg = Message.obtain();

        @Override/*from  w  w w . j av  a  2 s .  com*/
        public void run() {
            String data = "&userid=" + user.getUserId();
            Log.e("data=", data);
            String result_data = NetUtil.getResponse(GetUserBankInfo, data);
            Log.e("result_data=", result_data);
            try {
                JSONObject jsonObject = new JSONObject(result_data);
                msg.what = CommunalInterfaces.GetUserBankInfo;
                msg.obj = jsonObject;
            } catch (JSONException e) {
                e.printStackTrace();
            } finally {
                handler.sendMessage(msg);
            }
        }
    }.start();
}