当前位置: 首页>>代码示例>>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;未经允许,请勿转载。