简体   繁体   中英

Avoid null pointer exception for touchlistener android

I want to avoid null pointer exception for the following.

I want to disable touch listener for a relative layout.

private RelativeLayout    container ;

container.setOnTouchListener(null);

Thank you

禁用您的 RelativeLayout 以便触摸事件永远不会触发。使用

container.setEnabled(false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM