当前位置: 首页>>代码示例>>Java>>正文


Java Message类代码示例

本文整理汇总了Java中android.os.Message的典型用法代码示例。如果您正苦于以下问题:Java Message类的具体用法?Java Message怎么用?Java Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Message类属于android.os包,在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connectionFailed

import android.os.Message; //导入依赖的package包/类
/**
 * Indicate that the connection attempt failed and notify the UI Activity.
 */
private void connectionFailed() {
    // Send a failure message back to the Activity
    Message msg = mHandler.obtainMessage(Constants.MESSAGE_TOAST);
    Bundle bundle = new Bundle();
    bundle.putString(Constants.TOAST, "Unable to connect device");
    msg.setData(bundle);
    mHandler.sendMessage(msg);

    mState = STATE_NONE;
    // Update UI title
    updateUserInterfaceTitle();

    // Start the service over to restart listening mode
    BluetoothChatService.this.startBT();
}
 
开发者ID:haraldh,项目名称:iconsole-android,代码行数:19,代码来源:BluetoothChatService.java

示例2: onStartCommand

import android.os.Message; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Running = true;
    // when the activity starts the service, it expects to start it for a new wallet
    // the service is possibly still occupied with saving the last opened wallet
    // so we queue the open request
    // this should not matter since the old activity is not getting updates
    // and the new one is not listening yet (although it will be bound)
    Timber.d("onStartCommand()");
    // For each start request, send a message to start a job and deliver the
    // start ID so we know which request we're stopping when we finish the job
    Message msg = mServiceHandler.obtainMessage();
    msg.arg2 = START_SERVICE;
    if (intent != null) {
        msg.setData(intent.getExtras());
        mServiceHandler.sendMessage(msg);
        return START_STICKY;
    } else {
        // process restart - don't do anything - let system kill it again
        stop();
        return START_NOT_STICKY;
    }
}
 
开发者ID:m2049r,项目名称:xmrwallet,代码行数:24,代码来源:WalletService.java

示例3: handleMessage

import android.os.Message; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
    final int userId = msg.arg2;
    final int n = mCallbacks.beginBroadcast();
    for (int i = 0; i < n; i++) {
        final IPackageInstallerCallback callback = mCallbacks.getBroadcastItem(i);
        final VUserHandle user = (VUserHandle) mCallbacks.getBroadcastCookie(i);
        // TODO: dispatch notifications for slave profiles
        if (userId == user.getIdentifier()) {
            try {
                invokeCallback(callback, msg);
            } catch (RemoteException ignored) {
            }
        }
    }
    mCallbacks.finishBroadcast();
}
 
开发者ID:codehz,项目名称:container,代码行数:18,代码来源:VPackageInstallerService.java

示例4: handleMessage

import android.os.Message; //导入依赖的package包/类
public void handleMessage(Message msg) {
    super.handleMessage(msg);
    String smsg = msg.obj.toString();
    if (msg.what == 0) {
        try {
            LEYUApplication.dev_access_token = ((JSONObject) new JSONTokener(smsg)
                    .nextValue()).getString("access_token");
            LEYUApplication.set("leyu_dev_access_token", LEYUApplication.dev_access_token);
            LEYUApplication.this._callback.ReturnAccessToken(LEYUApplication
                    .dev_access_token);
        } catch (JSONException ex) {
            ex.printStackTrace();
            LEYUApplication.this._callback.onFailed(ex.getMessage());
        }
    } else if (msg.what == 1) {
        LEYUApplication.this._callback.OnCompleted(smsg);
    } else if (msg.what == 2) {
        LEYUApplication.this._callback.onFailed(smsg);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:LEYUApplication.java

示例5: goNext

import android.os.Message; //导入依赖的package包/类
private void goNext(final int nextIndex) {
    if (this.mHandler == null || this.mList == null) {
        FileDownloadLog.w(this, "need go next %d, but params is not ready %s %s",
                nextIndex, this.mHandler, this.mList);
        return;
    }

    Message nextMsg = this.mHandler.obtainMessage();
    nextMsg.what = WHAT_SERIAL_NEXT;
    nextMsg.arg1 = nextIndex;
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(SerialHandlerCallback.class, "start next %s %s",
                this.mList == null ? null : this.mList.get(0) == null ? null :
                        this.mList.get(0).getOrigin().getListener(), nextMsg.arg1);
    }
    this.mHandler.sendMessage(nextMsg);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:QueuesHandler.java

示例6: show

import android.os.Message; //导入依赖的package包/类
public void show(View parent){
    this.showAtLocation(parent, Gravity.CENTER,0,0);

    new Thread(new Runnable(){
        @Override
        public void run() {
            //此处while的条件alpha不能<= 否则会出现黑屏
            while(layoutParams.alpha > 0.5f){
                try {
                    Thread.sleep(6);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                Message msg =mHandler.obtainMessage();
                msg.what = 1;
                layoutParams.alpha -= 0.01f;
                msg.obj = layoutParams;
                mHandler.sendMessage(msg);
            }
        }
    }).start();
}
 
开发者ID:xhd-Git,项目名称:3DPrint-Controller,代码行数:23,代码来源:ModelInfoPopupWindow.java

示例7: setPortrait

import android.os.Message; //导入依赖的package包/类
private void setPortrait(){
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                pngBM = User.getInstance().getUserPortrait();

                Message msg = new Message();
                msg.what = 0;
                handler.sendMessage(msg);

            } catch (Exception e) {
                e.printStackTrace();
            }

        }
    });
    thread.start();
}
 
开发者ID:lzmlsfe,项目名称:19porn,代码行数:20,代码来源:PersonInfoActivity.java

示例8: register

import android.os.Message; //导入依赖的package包/类
public OkBus register(int tag, final Event ev, int thread) {
    SparseArray<Event> mEvent = new SparseArray<>();
    mEvent.put(thread, ev);
    if (mEventList.get(tag) != null) {
        mEventList.get(tag).add(mEvent);
    } else {
        List<SparseArray<Event>> mList = new ArrayList<>();
        mList.add(mEvent);
        mEventList.put(tag, mList);
    }
    LogUtils.e("Bus register", tag + " :" + mEventList.get(tag).size());
    if (mStickyEventList.get(tag) != null) {//注册时分发粘连事件
        final Message msg = new Message();
        msg.obj = mStickyEventList.get(tag);
        msg.what = tag;
        callEvent(msg, ev, thread);
        LogUtils.e("mStickyEvent register  and  onEvent", tag + " :" + mEventList.get(tag).size());
    }
    return this;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:OkBus.java

示例9: handleMessage

import android.os.Message; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
    switch (msg.what) {
        case MESSAGE_FADE_OUT:
            log.i("isfu123", "isfu123");
            if (isShowing){
                hide(1);
            }
            break;
        case MESSAGE_HIDE_BOX:
            $.id(R.id.app_video_center_box_right).gone();
            $.id(R.id.app_video_center_box_left).gone();
            $.id(R.id.app_video_top_box_right).gone();
            show(defaultTimeout,true);
            break;
        case MESSAGE_SHOW_BOX:
            show(defaultTimeout,true);
            break;
        case MESSAGE_SEEK_NEW_POSITION:
            break;
        case MESSAGE_RESTART_PLAY:
            play(url);
            break;
    }
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:26,代码来源:GiraffePlayer.java

示例10: preview

import android.os.Message; //导入依赖的package包/类
public final void preview(boolean start, SurfaceView view, int uid) {
    if (Thread.currentThread() != this) {
        log.warn("preview() - worker thread asynchronously " + start + " " + view + " " + (uid & 0XFFFFFFFFL));
        Message envelop = new Message();
        envelop.what = ACTION_WORKER_PREVIEW;
        envelop.obj = new Object[]{start, view, uid};
        mWorkerHandler.sendMessage(envelop);
        return;
    }

    ensureRtcEngineReadyLock();
    if (start) {
        mRtcEngine.setupLocalVideo(new VideoCanvas(view, VideoCanvas.RENDER_MODE_HIDDEN, uid));
        mRtcEngine.startPreview();
    } else {
        mRtcEngine.stopPreview();
    }
}
 
开发者ID:AgoraIO,项目名称:OpenVideoCall-Android,代码行数:19,代码来源:WorkerThread.java

示例11: handleMessage

import android.os.Message; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
    switch (msg.what) {
        case REQUEST_UPDATE:
            UIProgressRequestListener uiProgressRequestListener = mUIProgressRequestListenerWeakReference.get();
            if (uiProgressRequestListener != null) {
                //获得进度实体类
                ProgressModel progressModel = (ProgressModel) msg.obj;
                //回调抽象方法
                uiProgressRequestListener.onUIRequestProgress(progressModel.getCurrentBytes(), progressModel.getContentLength(), progressModel.isDone());
            }
            break;
        default:
            super.handleMessage(msg);
            break;
    }
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:18,代码来源:UIProgressRequestListener.java

示例12: handleMessage

import android.os.Message; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
  InitActivity ctx = (InitActivity) mContext.get();
  switch (msg.what) {
    case 0:
      ctx.mPD.dismiss();
      Intent src = ctx.getIntent();
      Intent i = new Intent();
      i.setClassName(src.getStringExtra("package"), src.getStringExtra("className"));
      i.setData(src.getData());
      i.putExtras(src);
      i.putExtra(FROM_ME, true);
      ctx.startActivity(i);
      ctx.finish();
      break;
  }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:18,代码来源:InitActivity.java

示例13: updateSub

import android.os.Message; //导入依赖的package包/类
private void updateSub(int subType, byte[] bytes, String encoding, int width, int height) {
  if (mEventHandler != null) {
    Message m = mEventHandler.obtainMessage(MEDIA_TIMED_TEXT, width, height);
    Bundle b = m.getData();
    if (subType == SUBTITLE_TEXT) {
      b.putInt(MEDIA_SUBTITLE_TYPE, SUBTITLE_TEXT);
      if (encoding == null) {
        b.putString(MEDIA_SUBTITLE_STRING, new String(bytes));
      } else {
        try {
          b.putString(MEDIA_SUBTITLE_STRING, new String(bytes, encoding.trim()));
        } catch (UnsupportedEncodingException e) {
          Log.e("updateSub", e);
          b.putString(MEDIA_SUBTITLE_STRING, new String(bytes));
        }
      }
    } else if (subType == SUBTITLE_BITMAP) {
      b.putInt(MEDIA_SUBTITLE_TYPE, SUBTITLE_BITMAP);
      b.putByteArray(MEDIA_SUBTITLE_BYTES, bytes);
    }
    mEventHandler.sendMessage(m);
  }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:24,代码来源:MediaPlayer.java

示例14: after

import android.os.Message; //导入依赖的package包/类
@Override
protected void after(XParam param) throws Throwable {
	if (mMethod == Methods.next) {
		Message msg = (Message) param.getResult();
		if (msg != null) {
			if (msg.obj instanceof Intent) {
				Intent intent = (Intent) msg.obj;
				if (intent != null)
					if (checkIntent(Binder.getCallingUid(), intent))
						param.setResult(null);
			}
		}

	} else if (mMethod == Methods.handleReceiver) {
		// Do nothing

	} else
		Util.log(this, Log.WARN, "Unknown method=" + param.method.getName());
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:20,代码来源:XActivityThread.java

示例15: init

import android.os.Message; //导入依赖的package包/类
private void init() {
    handler = new Handler(getLooper()) {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case CHECK_HITALK_CONVERSATION:
                        MonitorEvent monitorEvent = (MonitorEvent) msg.obj;
                        Message newMsg = new Message();
                        newMsg.copyFrom(msg);
                        if (!monitorEvent.check()) {
                            IMMEDIATE_TIMES ++;
                            monitorEvent.run();
                            handler.sendMessageDelayed(newMsg,
                                    LOOP_IMMEDIATE + (IMMEDIATE_TIMES / 3) * LOOP_INCREAMENT);
                        } else {
                            IMMEDIATE_TIMES = 0;
                            handler.sendMessageDelayed(newMsg,
                                    LOOP_TIME);
                        }
                    break;
            }
        }
    };
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:25,代码来源:HitalkMonitor.java


注:本文中的android.os.Message类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。