當前位置: 首頁>>代碼示例>>Java>>正文


Java Handler.Callback方法代碼示例

本文整理匯總了Java中android.os.Handler.Callback方法的典型用法代碼示例。如果您正苦於以下問題:Java Handler.Callback方法的具體用法?Java Handler.Callback怎麽用?Java Handler.Callback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.os.Handler的用法示例。


在下文中一共展示了Handler.Callback方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleMessage

import android.os.Handler; //導入方法依賴的package包/類
@Override
public void handleMessage(@NonNull Message msg) {
    if (mCallback == null) {
        return;
    }
    final Handler.Callback callback = mCallback.get();
    if (callback == null) { // Already disposed
        return;
    }
    callback.handleMessage(msg);
}
 
開發者ID:Mrqinlei,項目名稱:ImitateZHRB,代碼行數:12,代碼來源:WeakHandler.java

示例2: SnackbarManager

import android.os.Handler; //導入方法依賴的package包/類
private SnackbarManager() {
  mLock = new Object();
      mHandler = new Handler(Looper.getMainLooper(), new Handler.Callback() {
            @Override
            public boolean handleMessage(Message message) {
              switch (message.what) {
                case MSG_TIMEOUT:
                  handleTimeout((SnackbarRecord) message.obj);
                  return true;
              }
              return false;
            }
          });
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:15,代碼來源:SnackbarManager.java

示例3: getHCallback

import android.os.Handler; //導入方法依賴的package包/類
private static Handler.Callback getHCallback() {
	try {
		Handler handler = getH();
		return mirror.android.os.Handler.mCallback.get(handler);
	} catch (Throwable e) {
		e.printStackTrace();
	}
	return null;
}
 
開發者ID:codehz,項目名稱:container,代碼行數:10,代碼來源:HCallbackHook.java

示例4: onCreate

import android.os.Handler; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hybrid_test);

    uiHandler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) {
            if (msg.what == WHAT_NEED_AUTO_2_BOTTOM) {
                needAuto2Bottom = true;
            }
            return false;
        }
    });

    assignViews();
    scrollView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                uiHandler.removeMessages(WHAT_NEED_AUTO_2_BOTTOM);
                needAuto2Bottom = false;
            }

            if (event.getAction() == MotionEvent.ACTION_UP ||
                    event.getAction() == MotionEvent.ACTION_CANCEL) {
                uiHandler.removeMessages(WHAT_NEED_AUTO_2_BOTTOM);
                uiHandler.sendEmptyMessageDelayed(WHAT_NEED_AUTO_2_BOTTOM, 1000);
            }

            return false;
        }
    });
}
 
開發者ID:yannanzheng,項目名稱:FileDownloader-master,代碼行數:35,代碼來源:HybridTestActivity.java

示例5: BundleReleaser

import android.os.Handler; //導入方法依賴的package包/類
public BundleReleaser(final File reversionDir,boolean hasReleased) {
    if(Boolean.FALSE.booleanValue()){
        String.valueOf(PreVerifier.class);
    }
    this.hasReleased = hasReleased;
    this.reversionDir = reversionDir;
    if(!reversionDir.getAbsolutePath().startsWith(KernalConstants.baseContext.getFilesDir().getAbsolutePath())){
        externalStorage = true;
    }
    if (!(Looper.getMainLooper() == Looper.myLooper())) {
        if (Looper.myLooper() == null)
            Looper.prepare();
    }
    handler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) {
            try {
                return handleMsg(msg);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return false;
        }
    });

    this.service = Executors.newFixedThreadPool(3);
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:28,代碼來源:BundleReleaser.java

示例6: isEnvBad

import android.os.Handler; //導入方法依賴的package包/類
@Override
public boolean isEnvBad() {
	Handler.Callback callback = getHCallback();
	boolean envBad = callback != this;
	if (callback != null && envBad) {
		VLog.d(TAG, "HCallback has bad, other callback = " + callback);
	}
	return envBad;
}
 
開發者ID:codehz,項目名稱:container,代碼行數:10,代碼來源:HCallbackHook.java

示例7: CookieSaver

import android.os.Handler; //導入方法依賴的package包/類
public CookieSaver() {
  mHandler = new Handler(Looper.getMainLooper(), new Handler.Callback() {
    @Override
    public boolean handleMessage(Message msg) {
      if (msg.what == MSG_PERSIST_COOKIES) {
        persistCookies();
        return true;
      } else {
        return false;
      }
    }
  });
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:14,代碼來源:ForwardingCookieHandler.java

示例8: ExecHandler

import android.os.Handler; //導入方法依賴的package包/類
ExecHandler(WeakReference<Handler.Callback> callback) {
    mCallback = callback;
}
 
開發者ID:Mrqinlei,項目名稱:ImitateZHRB,代碼行數:4,代碼來源:WeakHandler.java

示例9: onForceDownloadAlert

import android.os.Handler; //導入方法依賴的package包/類
@Override
public void onForceDownloadAlert(String url, DefaultMsgConfig.DownLoadMsgConfig message, Handler.Callback callback) {
    getDelegate().onForceDownloadAlert(url, message, callback);
}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:5,代碼來源:AgentWebUIControllerImplBase.java

示例10: showChooser

import android.os.Handler; //導入方法依賴的package包/類
@Override
public void showChooser(WebView view, String url, final String[] ways, final Handler.Callback callback) {
    showChooserInternal(ways, callback);
}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:5,代碼來源:DefaultUIController.java

示例11: ExecHandler

import android.os.Handler; //導入方法依賴的package包/類
ExecHandler(Looper looper, WeakReference<Handler.Callback> callback) {
    super(looper);
    mCallback = callback;
}
 
開發者ID:wuyisheng,項目名稱:libRtmp,代碼行數:5,代碼來源:WeakHandler.java

示例12: WeakHandler

import android.os.Handler; //導入方法依賴的package包/類
/**
 * Use the provided {@link Looper} instead of the default one and take a callback
 * interface in which to handle messages.
 *
 * @param looper The looper, must not be null.
 * @param callback The callback interface in which to handle messages, or null.
 */
public WeakHandler(@NonNull Looper looper, @NonNull Handler.Callback callback) {
    mCallback = callback;
    mExec = new ExecHandler(looper, new WeakReference<>(callback));
}
 
開發者ID:Mrqinlei,項目名稱:ImitateZHRB,代碼行數:12,代碼來源:WeakHandler.java

示例13: MilesHandler

import android.os.Handler; //導入方法依賴的package包/類
/**
 * Constructor associates this handler with the {@link Looper} for the
 * current thread and takes a callback interface in which you can handle
 * messages.
 * <p>
 * If this thread does not have a looper, this handler won't be able to receive messages
 * so an exception is thrown.
 *
 * @param callback The callback interface in which to handle messages, or null.
 */
public MilesHandler(@Nullable Handler.Callback callback) {
    mCallback = callback; // Hard referencing body
    mExec = new ExecHandler(new WeakReference<>(callback)); // Weak referencing inside ExecHandler
}
 
開發者ID:sieml,項目名稱:CalendarCheck,代碼行數:15,代碼來源:MilesHandler.java

示例14: WeakHandler

import android.os.Handler; //導入方法依賴的package包/類
/**
 * Constructor associates this handler with the {@link Looper} for the
 * current thread and takes a callback interface in which you can handle
 * messages.
 * <p/>
 * If this thread does not have a looper, this handler won't be able to receive messages
 * so an exception is thrown.
 *
 * @param callback The callback interface in which to handle messages, or null.
 */
public WeakHandler(Handler.Callback callback) {
    mCallback = callback; // Hard referencing body
    mExec = new ExecHandler(new WeakReference<>(callback)); // Weak referencing inside ExecHandler
}
 
開發者ID:Lizhny,項目名稱:BigDataFortuneTelling,代碼行數:15,代碼來源:WeakHandler.java

示例15: XHandler

import android.os.Handler; //導入方法依賴的package包/類
/**
 * Use the provided {@link Looper} instead of the default one and take a callback
 * interface in which to handle messages.
 *
 * @param looper The looper, must not be null.
 * @param callback The callback interface in which to handle messages, or null.
 */
public XHandler(@NonNull Looper looper, @NonNull Handler.Callback callback) {
    mCallback = callback;
    mExec = new ExecHandler(looper, new WeakReference<>(callback));
}
 
開發者ID:youth5201314,項目名稱:XFrame,代碼行數:12,代碼來源:XHandler.java


注:本文中的android.os.Handler.Callback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。