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


Java HandlerThread.getLooper方法代码示例

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


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

示例1: n

import android.os.HandlerThread; //导入方法依赖的package包/类
private n(Context context) {
    try {
        HandlerThread handlerThread = new HandlerThread("StatStore");
        handlerThread.start();
        e.w("Launch store thread:" + handlerThread);
        this.a = new Handler(handlerThread.getLooper());
        Context applicationContext = context.getApplicationContext();
        this.d = new w(applicationContext);
        this.d.getWritableDatabase();
        this.d.getReadableDatabase();
        b(applicationContext);
        c();
        f();
        this.a.post(new o(this));
    } catch (Object th) {
        e.e(th);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:n.java

示例2: onCreate

import android.os.HandlerThread; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

    final PackageInfo packageInfo = application.packageInfo();
    final int versionNameSplit = packageInfo.versionName.indexOf('-');
    final HttpUrl.Builder url = HttpUrl
            .parse(Constants.VERSION_URL
                    + (versionNameSplit >= 0 ? packageInfo.versionName.substring(versionNameSplit) : ""))
            .newBuilder();
    url.addEncodedQueryParameter("package", packageInfo.packageName);
    url.addQueryParameter("current", Integer.toString(packageInfo.versionCode));
    versionUrl = url.build();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:19,代码来源:AlertDialogsFragment.java

示例3: 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

示例4: onCreate

import android.os.HandlerThread; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mLoaderThread = new HandlerThread("wallpaper_loader");
    mLoaderThread.start();
    mLoaderHandler = new Handler(mLoaderThread.getLooper(), this);

    init();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:11,代码来源:WallpaperCropActivity.java

示例5: starts

import android.os.HandlerThread; //导入方法依赖的package包/类
private void starts(){
    stops();
    workThread = new HandlerThread(
            GlobalAsyncThread.class.getSimpleName(),
            Process.THREAD_PRIORITY_BACKGROUND);
    workThread.start();
    workHandler  = new Handler(workThread.getLooper());
}
 
开发者ID:wuyisheng,项目名称:libRtmp,代码行数:9,代码来源:GlobalAsyncThread.java

示例6: 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:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:17,代码来源:LicenseChecker.java

示例7: onCreate

import android.os.HandlerThread; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setRetainInstance(true);
    setHasOptionsMenu(true);

    bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

    if (savedInstanceState != null) {
        restoreInstanceState(savedInstanceState);
    } else {
        final Intent intent = activity.getIntent();
        final String action = intent.getAction();
        final Uri intentUri = intent.getData();
        final String scheme = intentUri != null ? intentUri.getScheme() : null;
        final String mimeType = intent.getType();

        if ((Intent.ACTION_VIEW.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))
                && intentUri != null && "bitcoin".equals(scheme)) {
            initStateFromBitcoinUri(intentUri);
        } else if ((NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))
                && PaymentProtocol.MIMETYPE_PAYMENTREQUEST.equals(mimeType)) {
            final NdefMessage ndefMessage = (NdefMessage) intent
                    .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)[0];
            final byte[] ndefMessagePayload = Nfc.extractMimePayload(PaymentProtocol.MIMETYPE_PAYMENTREQUEST,
                    ndefMessage);
            initStateFromPaymentRequest(mimeType, ndefMessagePayload);
        } else if ((Intent.ACTION_VIEW.equals(action))
                && PaymentProtocol.MIMETYPE_PAYMENTREQUEST.equals(mimeType)) {
            final byte[] paymentRequest = BitcoinIntegration.paymentRequestFromIntent(intent);

            if (intentUri != null)
                initStateFromIntentUri(mimeType, intentUri);
            else if (paymentRequest != null)
                initStateFromPaymentRequest(mimeType, paymentRequest);
            else
                throw new IllegalArgumentException();
        } else if (intent.hasExtra(SendCoinsActivity.INTENT_EXTRA_PAYMENT_INTENT)) {
            initStateFromIntentExtras(intent.getExtras());
        } else {
            updateStateFrom(PaymentIntent.blank());
        }
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:50,代码来源:SendCoinsFragment.java

示例8: VideoFileRenderer

import android.os.HandlerThread; //导入方法依赖的package包/类
public VideoFileRenderer(String outputFile, int outputFileWidth, int outputFileHeight,
    final EglBase.Context sharedContext) throws IOException {
  if ((outputFileWidth % 2) == 1 || (outputFileHeight % 2) == 1) {
    throw new IllegalArgumentException("Does not support uneven width or height");
  }

  this.outputFileName = outputFile;
  this.outputFileWidth = outputFileWidth;
  this.outputFileHeight = outputFileHeight;

  outputFrameSize = outputFileWidth * outputFileHeight * 3 / 2;
  outputFrameBuffer = ByteBuffer.allocateDirect(outputFrameSize);

  videoOutFile = new FileOutputStream(outputFile);
  videoOutFile.write(
      ("YUV4MPEG2 C420 W" + outputFileWidth + " H" + outputFileHeight + " Ip F30:1 A1:1\n")
          .getBytes());

  renderThread = new HandlerThread(TAG);
  renderThread.start();
  renderThreadHandler = new Handler(renderThread.getLooper());

  ThreadUtils.invokeAtFrontUninterruptibly(renderThreadHandler, new Runnable() {
    @Override
    public void run() {
      eglBase = EglBase.create(sharedContext, EglBase.CONFIG_PIXEL_BUFFER);
      eglBase.createDummyPbufferSurface();
      eglBase.makeCurrent();
      yuvConverter = new YuvConverter();
    }
  });
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:33,代码来源:VideoFileRenderer.java

示例9: OkCameraManager

import android.os.HandlerThread; //导入方法依赖的package包/类
private OkCameraManager(Context context) {
    mCameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
    if (mCameraManager == null) {
        throw new RuntimeException("GET CAMERA MANAGER ERROR !");
    }

    HandlerThread ht = new HandlerThread("OkCameraManager Instance handler thread");
    ht.start();
    mCameraHandler = new CameraHandler(ht.getLooper());
}
 
开发者ID:OkayCamera,项目名称:OkayCamera-Android,代码行数:11,代码来源:OkCameraManager.java

示例10: onCreate

import android.os.HandlerThread; //导入方法依赖的package包/类
@Override
public void onCreate() {
	HandlerThread thread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
	thread.start();
	
	mServiceLooper = thread.getLooper();
	mServiceHandler = new ServiceHandler(mServiceLooper);
	
	mSmsManager = SmsManager.getDefault();
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:11,代码来源:BarrageService.java

示例11: createOffer

import android.os.HandlerThread; //导入方法依赖的package包/类
/**
 * Creates a offer for a newly created Realm.
 *
 * @param user User that should create the offer
 * @param realmName Realm to create
 * @param level accessLevel to offer
 * @param expires when the offer expires
 */
private String createOffer(final SyncUser user, final String realmName, final AccessLevel level, final Date expires) {
    final CountDownLatch offerReady = new CountDownLatch(1);
    final AtomicReference<String> offer = new AtomicReference<>(null);
    final HandlerThread ht = new HandlerThread("OfferThread");
    ht.start();
    Handler handler = new Handler(ht.getLooper());
    handler.post(new Runnable() {
        @Override
        public void run() {
            String url = createRemoteRealm(user, realmName);
            final PermissionManager pm = user.getPermissionManager();
            pm.makeOffer(new PermissionOffer(url, level, expires), new PermissionManager.MakeOfferCallback() {
                @Override
                public void onSuccess(String offerToken) {
                    offer.set(offerToken);
                    pm.close();
                    offerReady.countDown();
                }

                @Override
                public void onError(ObjectServerError error) {
                    pm.close();
                    fail(error.toString());
                }
            });
        }
    });
    TestHelper.awaitOrFail(offerReady);
    ht.quit();
    return offer.get();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:PermissionManagerTests.java

示例12: onCreate

import android.os.HandlerThread; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	mContext = getActivity();
	
	mSubThread = new HandlerThread(this.getClass().getName());
	// mSubThread.setPriority(Thread.MIN_PRIORITY); //设置线程优先级
	mSubThread.start();
	
	mUiHandler = new Handler(getActivity().getMainLooper(), mUiHandlerCallback);
	
	mSubHandler = new Handler(mSubThread.getLooper(), mSubHandlerCallback);
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:15,代码来源:BaseFragment.java

示例13: startBackgroundThread

import android.os.HandlerThread; //导入方法依赖的package包/类
/**
 * Starts a background thread and its {@link Handler}.
 */
private void startBackgroundThread() {
  handlerThread = new HandlerThread("CAMERA_BACKGROUND");
  handlerThread.start();
  backgroundHandler = new Handler(handlerThread.getLooper());
}
 
开发者ID:zugaldia,项目名称:android-robocar,代码行数:9,代码来源:CameraOperator.java

示例14: TestContentObserver

import android.os.HandlerThread; //导入方法依赖的package包/类
private TestContentObserver(HandlerThread ht) {
    super(new Handler(ht.getLooper()));
    mHT = ht;
}
 
开发者ID:fjoglar,项目名称:android-dev-challenge,代码行数:5,代码来源:TestUtilities.java

示例15: initHandler

import android.os.HandlerThread; //导入方法依赖的package包/类
private void initHandler() {
    mHandlerThread = new HandlerThread("ScreenShot");
    mHandlerThread.start();
    handler = new Handler(mHandlerThread.getLooper());
}
 
开发者ID:jiangkang,项目名称:KTools,代码行数:6,代码来源:BaseActivity.java


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