本文整理汇总了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);
}
}
示例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();
}
示例3: startBackgroundThread
import android.os.HandlerThread; //导入方法依赖的package包/类
private void startBackgroundThread() {
mBackgroundThread = new HandlerThread("Camera Background");
mBackgroundThread.start();
mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
}
示例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();
}
示例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());
}
示例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());
}
示例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());
}
}
}
示例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();
}
});
}
示例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());
}
示例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();
}
示例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();
}
示例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);
}
示例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());
}
示例14: TestContentObserver
import android.os.HandlerThread; //导入方法依赖的package包/类
private TestContentObserver(HandlerThread ht) {
super(new Handler(ht.getLooper()));
mHT = ht;
}
示例15: initHandler
import android.os.HandlerThread; //导入方法依赖的package包/类
private void initHandler() {
mHandlerThread = new HandlerThread("ScreenShot");
mHandlerThread.start();
handler = new Handler(mHandlerThread.getLooper());
}