android tap jacking, how to prevent it

前端 未结 1 980
长情又很酷
长情又很酷 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)
提交回复
热议问题