简体   繁体   中英

Long click listener on 2 buttons at the same time

I would like to do a long click listener for 2 buttons . I mean clicking on the 2 buttons(a and b) at the same time will close the app. How can i manage this? thank you in advance .

I find this solution using isPressed method. It is working.

    iconD.setOnLongClickListener(new View.OnLongClickListener() {
         @Override
         public boolean onLongClick(View view) {
             if (view.getId() == R.id.picture_d) {
                 if (iconR.isPressed() && iconD.isPressed()) {
                       askingForClosingTheApp();
                 }
              }
              return true;
         }
   });

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