【发布时间】:2011-05-05 18:45:09
【问题描述】:
当玩家触摸 adwhirl 横幅的广告时,我想做一个动作(增加一个计数器)。 我已经看到 AdWhirl 类有一个每次触摸都会调用的方法:
//We intercept clicks to provide raw metrics
public boolean onInterceptTouchEvent(MotionEvent event) {
switch(event.getAction()) {
//Sending on an ACTION_DOWN isn't 100% correct... user could have touched down and dragged out. Unlikely though.
case MotionEvent.ACTION_DOWN:
Log.d(AdWhirlUtil.ADWHIRL, "Intercepted ACTION_DOWN event");
countClickThreaded();
if(activeRation.type == 9) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(custom.link));
this.context.startActivity(intent);
}
break;
}
// Return false so subViews can process event normally.
return false;
}
好吧,我该如何使用它?我应该实现一个监听器吗?或者也许是一个像这样实现 AdWhirlInterface 的类? Handle AdWhirl onFailure
我真的不知道如何移动:(
【问题讨论】:
-
不能用这个方法吗?将您的代码添加到他们已经使用的方法中?
-
我不想更改他班级中的 AdWhirl 方法,因为当它更新 AdWhirl jar 时,我应该记得再次进行更改。好吧,对我来说,这似乎并不“干净”。
标签: android touch intercept adwhirl