當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。