本文整理匯總了Java中android.os.Message.setTarget方法的典型用法代碼示例。如果您正苦於以下問題:Java Message.setTarget方法的具體用法?Java Message.setTarget怎麽用?Java Message.setTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.os.Message
的用法示例。
在下文中一共展示了Message.setTarget方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onLongPress
import android.os.Message; //導入方法依賴的package包/類
@Override
/**
* handles long presses for the browser, tries to get the
* url of the item that was clicked and sends it (it can be null)
* to the click handler that does cool stuff with it
*/
public void onLongPress() {
if (mClickHandler == null) {
mClickHandler = new ClickHandler(mActivity);
}
Message click = mClickHandler.obtainMessage();
if (click != null) {
click.setTarget(mClickHandler);
getCurrentWebView().getWebView().requestFocusNodeHref(click);
}
}
示例2: initScriptsFramework
import android.os.Message; //導入方法依賴的package包/類
/**
* Initialize JavaScript framework
* @param framework String representation of the framework to be init.
*/
public synchronized void initScriptsFramework(String framework) {
Message msg = mJSHandler.obtainMessage();
msg.obj = framework;
msg.what = WXJSBridgeMsgType.INIT_FRAMEWORK;
msg.setTarget(mJSHandler);
msg.sendToTarget();
}
示例3: takeJSHeapSnapshot
import android.os.Message; //導入方法依賴的package包/類
public void takeJSHeapSnapshot(String filename) {
Message msg = mJSHandler.obtainMessage();
msg.obj = filename;
msg.what = WXJSBridgeMsgType.TAKE_HEAP_SNAPSHOT;
msg.setTarget(mJSHandler);
msg.sendToTarget();
}
示例4: onLongPress
import android.os.Message; //導入方法依賴的package包/類
@Override
public void onLongPress(MotionEvent e) {
if (mCanTriggerLongPress) {
Message msg = mWebViewHandler.obtainMessage();
if (msg != null) {
msg.setTarget(mWebViewHandler);
if (mWebView == null) {
return;
}
mWebView.requestFocusNodeHref(msg);
}
}
}
示例5: onLongClick
import android.os.Message; //導入方法依賴的package包/類
@Override
public boolean onLongClick(View v) {
if (callback == null) {
return false;
}
final AmazonWebView.HitTestResult hitTestResult = webView.getHitTestResult();
switch (hitTestResult.getType()) {
case AmazonWebView.HitTestResult.SRC_ANCHOR_TYPE:
final String linkURL = hitTestResult.getExtra();
callback.onLongPress(new IWebView.HitTarget(true, linkURL, false, null));
return true;
case AmazonWebView.HitTestResult.IMAGE_TYPE:
final String imageURL = hitTestResult.getExtra();
callback.onLongPress(new IWebView.HitTarget(false, null, true, imageURL));
return true;
case AmazonWebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE:
// hitTestResult.getExtra() contains only the image URL, and not the link
// URL. Internally, WebView's HitTestData contains both, but they only
// make it available via requestFocusNodeHref...
final Message message = new Message();
message.setTarget(new Handler() {
@Override
public void handleMessage(Message msg) {
final Bundle data = msg.getData();
final String url = data.getString("url");
final String src = data.getString("src");
if (url == null || src == null) {
throw new IllegalStateException("WebView did not supply url or src for image link");
}
if (callback != null) {
callback.onLongPress(new IWebView.HitTarget(true, url, true, src));
}
}
});
webView.requestFocusNodeHref(message);
return true;
default:
return false;
}
}