Android Proguard - how to keep onClick handlers only referenced from XML layouts

前端 未结 3 1640
温柔的废话
温柔的废话 2021-01-11 10:47

In my Android app I ofter don\'t create a View\'s on-click handler in code, but rely on the ability to specify it in the XML layout file, like this:

   

        
3条回答
  •  感情败类
    2021-01-11 11:44

    I use:

    -keepclassmembers class * extends android.app.Activity { 
           public void on*Click(android.view.View); 
    }
    

    and then I name all onClick methods like: onCancelBtnClick(), onBackgroundClick(), etc.

提交回复
热议问题