android tap jacking, how to prevent it

前端 未结 1 986
长情又很酷
长情又很酷 2021-02-06 16:17

Trying to avoid my views touches receiving feedback from overlays ....

Here is an example of a hack someone could do on Android to allow the user to unintentionally pres

相关标签:
1条回答
  • 2021-02-06 16:38
    public class MyActivity extends Activity {
        protected void onCreate(Bundle bundle) {
            super.onCreate(bundle);
            final Button myButton = (Button)findViewById(R.id.button_id);
            myButton.setFilterTouchesWhenObscured(true);
            myButton.setOnClickListener(new View.OnClickListener() {
                // Perform action on click
                public void onClick(View v) {
    
                }
            }
        }
    }
    

    write this code for critical buttons

    0 讨论(0)
提交回复
热议问题