private static final int NETUPDATE=10;
================================================
接收部分
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg)
{
switch (msg.what) {
case NETUPDATE:
parseIni((String) msg.obj);
break;
}
================================================================
在另一个函数里的发送部分
Message tempMsg = mHandler.obtainMessage();
tempMsg.what = NETUPDATE;
tempMsg.obj = buffer.toString();
mHandler.sendMessage(tempMsg);
======================================================
也可以如下发送 但是另外的接收方式了
// send refresh UI event.
Message msg = handler.obtainMessage();
msg.what = Constants.UPDATE_LOCAL_DATA;
Bundle bundle = new Bundle();
bundle.putInt(Constants.BUNDLE_PAGE, currentPage);
bundle.putInt(Constants.BUNDLE_TPAGE, totalPage);
bundle.putInt(Constants.BUNDLE_INDEX, position);
msg.setData(bundle);
handler.sendMessage(msg);