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


Java HandlerThread.start方法代码示例

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


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

示例1: onCreate

import android.os.HandlerThread; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    context = getContext();
    telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    config = Configuration.getInstance();
    textLoader = Singleton.getInstance(TextLoader.class);
    highlightManager = Singleton.getInstance(HighlightManager.class);
    highlightManager.setConfig(config);

    bookmarkDatabaseHelper  = new BookmarkDatabaseHelper(context);
    super.onCreate(savedInstanceState);

    // Restore preferences
    this.uiHandler = new Handler();
    HandlerThread bgThread = new HandlerThread("background");
    bgThread.start();
    this.backgroundHandler = new Handler(bgThread.getLooper());
}
 
开发者ID:ceji-longquan,项目名称:ceji_android,代码行数:24,代码来源:ReadingFragment.java

示例2: openDB

import android.os.HandlerThread; //导入方法依赖的package包/类
/**
 *修改数据库的存贮路径为.../appkey/userID/,
 *必须确保userID存在后才能初始化DBManager
 */
public void openDB() {
    RLog.d(TAG, "SealUserInfoManager openDB");
    if (mDBManager == null || !mDBManager.isInitialized()) {
        mDBManager = DBManager.init(mContext);
        mWorkThread = new HandlerThread("sealUserInfoManager");
        mWorkThread.start();
        mWorkHandler = new Handler(mWorkThread.getLooper());
        mFriendDao = getFriendDao();
        mGroupsDao = getGroupsDao();
        mGroupMemberDao = getGroupMemberDao();
        mBlackListDao = getBlackListDao();
        mUserInfoCache = new LinkedHashMap<>();
        setUserInfoEngineListener();
    }
    mGetAllUserInfoState = sp.getInt("getAllUserInfoState", 0);
    RLog.d(TAG, "SealUserInfoManager mGetAllUserInfoState = " + mGetAllUserInfoState);
}
 
开发者ID:zqHero,项目名称:rongyunDemo,代码行数:22,代码来源:SealUserInfoManager.java

示例3: init

import android.os.HandlerThread; //导入方法依赖的package包/类
private void init() {
    if (isAndroidThingsDevice(this)) {
        initPIO();
    }

    mBackgroundThread = new HandlerThread("BackgroundThread");
    mBackgroundThread.start();
    mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
    mBackgroundHandler.post(mInitializeOnBackground);

    // Let the user touch the screen to take a photo
    findViewById(R.id.container).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mReady.get()) {
                Log.i(TAG, "Taking photo");
                setReady(false);
                mBackgroundHandler.post(mBackgroundClickHandler);
            } else {
                Log.i(TAG, "Sorry, processing hasn't finished. Try again in a few seconds");
            }
        }
    });
}
 
开发者ID:androidthings,项目名称:sample-tensorflow-imageclassifier,代码行数:25,代码来源:ImageClassifierActivity.java

示例4: onEnabled

import android.os.HandlerThread; //导入方法依赖的package包/类
@Override
protected void onEnabled(int track, long positionUs, boolean joining)
    throws ExoPlaybackException {
  super.onEnabled(track, positionUs, joining);
  parserIndex = getParserIndex(getFormat(track));
  parserThread = new HandlerThread("textParser");
  parserThread.start();
  parserHelper = new SubtitleParserHelper(parserThread.getLooper(), subtitleParsers[parserIndex]);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:10,代码来源:TextTrackRenderer.java

示例5: startBackgroundThread

import android.os.HandlerThread; //导入方法依赖的package包/类
private void startBackgroundThread() {
    Log.i(LOGTAG, "startBackgroundThread");
    stopBackgroundThread();
    mBackgroundThread = new HandlerThread("CameraBackground");
    mBackgroundThread.start();
    mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
}
 
开发者ID:johnhany,项目名称:MOAAP,代码行数:8,代码来源:Camera2Renderer.java

示例6: startBackgroundThread

import android.os.HandlerThread; //导入方法依赖的package包/类
/**
 * Starts a background thread and its {@link Handler}.
 */
private void startBackgroundThread() {
    mBackgroundThread = new HandlerThread("CameraBackground");
    mBackgroundThread.start();
    synchronized (mCameraStateLock) {
        mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
    }
}
 
开发者ID:gengqifu,项目名称:361Camera,代码行数:11,代码来源:Camera2Fragment.java

示例7: HwAvcEncoder

import android.os.HandlerThread; //导入方法依赖的package包/类
public HwAvcEncoder(final VideoConfig videoConfig, final MediaCodecCallback... callbacks) {
    mVideoConfig = videoConfig;
    mMediaCodecThread = new HandlerThread("HwAvcEncoderThread");
    mMediaCodecThread.start();
    mMediaCodecHandler = new Handler(mMediaCodecThread.getLooper());
    mVideoEncoder = new MediaCodecVideoEncoder();
    mMediaCodecCallbacks = Arrays.asList(callbacks);
}
 
开发者ID:Piasy,项目名称:VideoCRE,代码行数:9,代码来源:HwAvcEncoder.java

示例8: FrameSender

import android.os.HandlerThread; //导入方法依赖的package包/类
public FrameSender(final FrameSenderCallback frameSenderCallback) {
    this.frameSenderCallback = frameSenderCallback;
    final HandlerThread sendHandlerThread = new HandlerThread("send_thread");
    sendHandlerThread.start();
    sendHandler = new Handler(sendHandlerThread.getLooper()) {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);

            if (msg.what == MESSAGE_READY_TO_CLOSE) {
                if (msg.obj != null) {
                    addFrame((FramePool.Frame) msg.obj);
                }
                sendFrame(msg.arg1);

                frameSenderCallback.close();
                sendHandlerThread.quitSafely();
            } else if (msg.what == MSG_ADD_FRAME) {
                if (msg.obj != null) {
                    addFrame((FramePool.Frame) msg.obj);
                }
                sendFrame(msg.arg1);
            } else if (msg.what == MSG_START) {
                frameSenderCallback.onStart();
            }
        }
    };
}
 
开发者ID:ChillingVan,项目名称:AndroidInstantVideo,代码行数:29,代码来源:FrameSender.java

示例9: onResume

import android.os.HandlerThread; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    backgroundThread = new HandlerThread("handlerThread");
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

}
 
开发者ID:lazyparser,项目名称:xbot_head,代码行数:9,代码来源:CommentaryFragment.java

示例10: LicenseChecker

import android.os.HandlerThread; //导入方法依赖的package包/类
/**
 * @param context a Context
 * @param policy implementation of Policy
 * @param encodedPublicKey Base64-encoded RSA public key
 * @throws IllegalArgumentException if encodedPublicKey is invalid
 */
public LicenseChecker(Context context, Policy policy, String encodedPublicKey) {
    mContext = context;
    mPolicy = policy;
    mPublicKey = generatePublicKey(encodedPublicKey);
    mPackageName = mContext.getPackageName();
    mVersionCode = getVersionCode(context, mPackageName);
    HandlerThread handlerThread = new HandlerThread("background thread");
    handlerThread.start();
    mHandler = new Handler(handlerThread.getLooper());
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:17,代码来源:LicenseChecker.java

示例11: onResume

import android.os.HandlerThread; //导入方法依赖的package包/类
@Override
public synchronized void onResume() {
  LOGGER.d("onResume " + this);
  super.onResume();

  handlerThread = new HandlerThread("inference");
  handlerThread.start();
  handler = new Handler(handlerThread.getLooper());
}
 
开发者ID:apacha,项目名称:TensorflowAndroidDemo,代码行数:10,代码来源:CameraActivity.java

示例12: startBackgroundThread

import android.os.HandlerThread; //导入方法依赖的package包/类
private void startBackgroundThread() {
    mBackgroundThread = new HandlerThread("Camera Background");
    mBackgroundThread.start();
    mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
}
 
开发者ID:kevalpatel2106,项目名称:smart-lens,代码行数:6,代码来源:Camera2Api.java

示例13: getTestContentObserver

import android.os.HandlerThread; //导入方法依赖的package包/类
static TestContentObserver getTestContentObserver() {
    HandlerThread ht = new HandlerThread("ContentObserverThread");
    ht.start();
    return new TestContentObserver(ht);
}
 
开发者ID:fjoglar,项目名称:android-dev-challenge,代码行数:6,代码来源:TestUtilities.java

示例14: initLooper

import android.os.HandlerThread; //导入方法依赖的package包/类
private void initLooper() {
    mThreadHandler = new HandlerThread("CAMERA2");
    mThreadHandler.start();
    mHandler = new Handler(mThreadHandler.getLooper());
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:6,代码来源:JumpService.java

示例15: BackgroundExecutor

import android.os.HandlerThread; //导入方法依赖的package包/类
BackgroundExecutor() {
    HandlerThread handlerThread = new HandlerThread("queue-handler");
    handlerThread.start();
    this.threadId = handlerThread.getId();
    this.handler = new Handler(handlerThread.getLooper());
}
 
开发者ID:hermanliang,项目名称:AndroidGCD,代码行数:7,代码来源:DispatchQueue.java


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