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


Java Handler.sendEmptyMessage方法代码示例

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


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

示例1: connectDevice

import android.os.Handler; //导入方法依赖的package包/类
/**
     * 连接蓝牙(2)
     *
     * @return
     */
    public static BluetoothSocket connectDevice(final Handler handler) {
        BluetoothSocket socket = null;
        try {
            Comment.SPP_UUID = UUID.fromString("00001106-0000-1000-8000-00805F9B34FB");
            socket = Comment.bluetoothDevice.createRfcommSocketToServiceRecord(Comment.SPP_UUID);
            socket.connect();
            handler.sendEmptyMessage(Comment.CONNECT);
        } catch (Exception e) {
            handler.sendEmptyMessage(2);
            try {
                if (socket!=null)
                socket.close();
            } catch (Exception closeException) {

            }
        }
        return socket;
}
 
开发者ID:aiyangtianci,项目名称:BluetoothAPP,代码行数:24,代码来源:BluetoothUtil.java

示例2: freezeSerialHandler

import android.os.Handler; //导入方法依赖的package包/类
private void freezeSerialHandler(Handler handler) {
    handler.sendEmptyMessage(WHAT_FREEZE);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:QueuesHandler.java

示例3: updateClients

import android.os.Handler; //导入方法依赖的package包/类
public static void updateClients() {
	//myLog.l(Log.DEBUG, "UI update");
	//Log.d("UiUpdate", "Update now");
	for (Handler client : clients) {
		client.sendEmptyMessage(0);
	}
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:8,代码来源:UiUpdater.java

示例4: getFolderAllImg

import android.os.Handler; //导入方法依赖的package包/类
public static void getFolderAllImg(Context context, List<PictureInfo> datas, List<String> childList,final Handler handler) {
        for (int i = 0; i < childList.size(); i++) {
            int startTitle = childList.get(i).lastIndexOf("/") + 1;
            int endTitle = childList.get(i).lastIndexOf(".");
            String title = (String) childList.get(i).subSequence(startTitle, endTitle);
            String filename = childList.get(i);

            PictureInfo model = new PictureInfo();
            model.setFunction(ConstantsWhat.FunctionsIds.PREPARE);
            model.setAction("2screen");
            model.setAssettype("pic");
            model.setAssetname(title);
            model.setAssetpath(filename);
//            if (contains(context, title)) {
//                if (application == null) {
//                    application = (SavorApplication) context.getApplicationContext();
//                }
//                model.setAsseturl(application.GalleyPath + title + ".jpg");
//            } else {
            model.setAsseturl(NetWorkUtil.getLocalUrl(context) + filename);
//            }
            datas.add(model);
        }

        handler.sendEmptyMessage(INIT_SUCCESS);
        // calback.setData();
    }
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:28,代码来源:MediaUtils.java

示例5: onCreate

import android.os.Handler; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    tv_time = (TextView) findViewById(R.id.tv_time);
    tv_date = (TextView) findViewById(R.id.tv_date);
    tv_day = (TextView) findViewById(R.id.tv_day);
    Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/ds_digi.ttf");
    tv_time.setTypeface(typeFace);
    tv_date.setTypeface(typeFace);
    tv_weather = (TextView) findViewById(R.id.tv_weather);
    tv_descript = (TextView) findViewById(R.id.tv_descript);


    handler = new Handler(this);
    tv_setting = (TextView) findViewById(R.id.tv_setting);
    tv_setting.setOnClickListener(this);
    tv_time.setOnClickListener(this);
    RelativeLayout rel_main = (RelativeLayout) findViewById(R.id.rel_main);
    rel_main.setOnClickListener(this);
    init();
    PowerManager powerManager = (PowerManager) this.getSystemService(POWER_SERVICE);
    wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "Clock");
    localWakeLock = powerManager.newWakeLock(32, "MyPower");

    ClockApplication.getInstance().setMainActivity(this);
    ClockApplication.getInstance().getBusinessService().getWeather(model.getCity());

    timer = new Timer();
    TimerTask timerTask = new TimerTask() {
        @Override
        public void run() {
            handler.sendEmptyMessage(UPDATE_TIME);
        }
    };
    timer.schedule(timerTask, 1000, 1000);
    ClockApplication.getInstance().getBusinessService().checkUpdate();
}
 
开发者ID:socoolby,项目名称:CoolClock,代码行数:39,代码来源:MainActivity.java

示例6: onPause

import android.os.Handler; //导入方法依赖的package包/类
@Override
protected void onPause() {
    Log.d(TAG, "onPause");
    super.onPause();

    // if we get here too quickly, the handler might still be null; not dealing with that
    Handler handler = mRenderThread.getHandler();
    handler.sendEmptyMessage(0);
    mRenderThread = null;
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:11,代码来源:ChorTestActivity.java

示例7: notifyAuthorizationFailure

import android.os.Handler; //导入方法依赖的package包/类
public void notifyAuthorizationFailure() {
    Handler handler = this.b044E044E044E044Eюю;
    if (((b042904290429ЩЩЩ + b0429ЩЩ0429ЩЩ) * b042904290429ЩЩЩ) % b0429Щ04290429ЩЩ() != bЩЩЩ0429ЩЩ) {
        b042904290429ЩЩЩ = b04290429Щ0429ЩЩ();
        bЩЩЩ0429ЩЩ = 52;
    }
    handler.sendEmptyMessage(-1);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:9,代码来源:cccrcc.java

示例8: unFreezeSerialHandler

import android.os.Handler; //导入方法依赖的package包/类
private void unFreezeSerialHandler(Handler handler) {
    handler.sendEmptyMessage(WHAT_UNFREEZE);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:QueuesHandler.java

示例9: VSyncSampler

import android.os.Handler; //导入方法依赖的package包/类
private VSyncSampler() {
  choreographerOwnerThread = new HandlerThread("ChoreographerOwner:Handler");
  choreographerOwnerThread.start();
  handler = new Handler(choreographerOwnerThread.getLooper(), this);
  handler.sendEmptyMessage(CREATE_CHOREOGRAPHER);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:7,代码来源:VideoFrameReleaseTimeHelper.java

示例10: initUIHandler

import android.os.Handler; //导入方法依赖的package包/类
private void initUIHandler() {
    mUIEventHandler = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case UI_EVNET_HIDE_LOADING_ANIMATION:
                mLoadingAnimation.setVisibility(View.GONE);
                mStartButton.setEnabled(true);
                break;
            case UI_EVENT_SHOW_STREAMING_ACTIVITY:
                /**
                 * 点击开始推流
                 */
                Intent intent = new Intent(MainActivity.this, StreamingActivity.class);
                /**保存摄像头方向*/
                saveStreamParams();
                /**推流地址*/
                intent.putExtra("push_url", mStreamKey.trim());
                /**推流视频宽度*/
                intent.putExtra("res_w", mSupportedResolutionValues[mSelectedResolutionIndex * 2]);
                /**推流视频高度*/
                intent.putExtra("res_h", mSupportedResolutionValues[mSelectedResolutionIndex * 2 + 1]);
                /**视频帧率*/
                intent.putExtra("frame_rate", mSupportedFramerateValues[mSelectedResolutionIndex]);
                /**视频码率*/
                intent.putExtra("bitrate", mSupportedBitrateValues[mSelectedResolutionIndex]);
                /**摄像头方向*/
                intent.putExtra("oritation_landscape", isOritationSwitcherChecked);
                startActivity(intent);
                break;
            case UI_EVENT_HINT_NO_STREAMING_URL:
                mStreamKey = mSharedPreferences.getString("user_avatar", "");
                Toast.makeText(MainActivity.this, "未获取到有效的推流地址,已使用上次推流的地址!", Toast.LENGTH_SHORT).show();
                mUIEventHandler.sendEmptyMessage(UI_EVENT_SHOW_STREAMING_ACTIVITY);
                break;
            default:
                break;
            }
            super.handleMessage(msg);
        }

    };

}
 
开发者ID:LiuJunb,项目名称:Android-LSS,代码行数:46,代码来源:MainActivity.java

示例11: sendMessageByFile

import android.os.Handler; //导入方法依赖的package包/类
/**
 * 发送文件
 */
public static void sendMessageByFile(Context context, Uri filePath, final Handler handler) {
    if (Comment.bluetoothSocket == null) {
        ToastUtil.showShort(context, "蓝牙连接失败...");
    }
    new Thread(new Runnable() {
        @Override
        public void run() {
            if (Comment.bluetoothSocket == null || !Comment.bluetoothSocket.isConnected()) {
                Comment.bluetoothSocket = BluetoothUtil.connectDevice(handler);
            }
        }
    }).start();
    Dialog dialog = new DialogUtil.DefineDialog(context, 100, 0, filePath);
    dialog.show();
    try {
        File file = new File(filePath.toString());
        if (!file.exists()) return;
        //将文件写入流
        FileInputStream fis = new FileInputStream(file);
        //每次上传1M的内容
        byte[] b = new byte[1024];
        int length;
        int fileSize = 0;//实时监测上传进度

        OutputStream outputStream = Comment.bluetoothSocket.getOutputStream();
        while ((length = fis.read(b)) != -1) {
            fileSize += length;
            listenr.setProgress((int) (fileSize / file.length() * 100));
            //2、把文件写入socket输出流
            outputStream.write(b, 0, length);
        }
        //关闭文件流
        fis.close();
        //该方法无效
        //outputStream.write("\n".getBytes());
        outputStream.flush();
        handler.sendEmptyMessage(0);
    } catch (IOException e) {
        handler.sendEmptyMessage(1);
        e.printStackTrace();
    }
}
 
开发者ID:aiyangtianci,项目名称:BluetoothAPP,代码行数:46,代码来源:SendSocketService.java

示例12: initHandler

import android.os.Handler; //导入方法依赖的package包/类
private void initHandler() {
    mHandler = new Handler() {
        @Override
        public void dispatchMessage(Message msg) {
            switch (msg.what) {
                case 2:
                    int resId = 0;
                    if (currentRecorderState == RecorderState.PRESS) {
                        resId = R.drawable.video_text01;
                    } else if (currentRecorderState == RecorderState.LOOSEN) {
                        resId = R.drawable.video_text02;
                    } else if (currentRecorderState == RecorderState.CHANGE) {
                        resId = R.drawable.video_text03;
                    } else if (currentRecorderState == RecorderState.SUCCESS) {
                        resId = R.drawable.video_text04;
                    }
                    stateImageView.setImageResource(resId);
                    break;
                case 3:
                    if (!recording)
                        initiateRecording(true);
                    else {
                        //更新暂停的时间
                        stopPauseTime = System.currentTimeMillis();
                        totalPauseTime = stopPauseTime - startPauseTime - ((long) (1.0 / (double) frameRate) * 1000);
                        pausedTime += totalPauseTime;
                    }
                    rec = true;
                    //开始进度条增长
                    progressView.setCurrentState(State.START);
                    //setTotalVideoTime();
                    break;
                case 4:
                    //设置进度条暂停状态
                    progressView.setCurrentState(State.PAUSE);
                    //将暂停的时间戳添加到进度条的队列中
                    progressView.putProgressList((int) totalTime);
                    rec = false;
                    startPauseTime = System.currentTimeMillis();
                    if (totalTime >= RECORDING_MINIMUM_TIME) {
                        currentRecorderState = RecorderState.SUCCESS;
                        mHandler.sendEmptyMessage(2);
                    } else if (totalTime >= RECORDING_CHANGE_TIME) {
                        currentRecorderState = RecorderState.CHANGE;
                        mHandler.sendEmptyMessage(2);
                    }
                    break;
                case 5:
                    currentRecorderState = RecorderState.SUCCESS;
                    mHandler.sendEmptyMessage(2);
                    break;
                default:
                    break;
            }
        }
    };
}
 
开发者ID:feigxj,项目名称:VideoRecorder-master,代码行数:58,代码来源:FFmpegRecorderActivity.java


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