[英]CWAC-Camera Take Photo on touch screen
I've tried implementing an onClickListener on a CameraFragment, however, it never seems to be called. 我尝试过在CameraFragment上实现onClickListener,但是,似乎从未调用过它。 I am probably missing something quite simple.
我可能缺少一些非常简单的东西。 Does anyone have any ideas?
有人有什么想法吗?
public class CWACCameraFragment extends CameraFragment implements OnClickListener {
//...
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
takePicture();
Toast.makeText(getActivity(),"click",
Toast.LENGTH_LONG).show();
}
Is there a way to ensure that the onClick event occurs? 有没有办法确保onClick事件发生?
In the demo app, I added the following to DemoCameraFragment
: 在演示应用程序中,我向
DemoCameraFragment
添加了以下DemoCameraFragment
:
@Override
public void onStart() {
super.onStart();
getView().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e(getClass().getSimpleName(), "got here");
}
});
}
Log messages showed up just fine. 日志消息显示很好。 Hence, AFAICT, your approach works, so perhaps there is some bug in how you wired in the click listener.
因此,AFAICT,您的方法可行,因此在如何连接点击侦听器中可能存在一些错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.