-2

I am working on a Currency Convertor Project in Java for Android. My buttons are labelled as Currency icons and I want user to know the details about currency via Toast message I want to generate that toast message when user Click and Hold any button. In short I want to add onHoldListener(Kind of) in my Code

Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53

1 Answers1

4

You can call setOnLongClickListener for your button:

 button.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {

            Toast.makeText(Context, "some text", Toast.LENGTH_SHORT).show();
            return true;
        }
    });
Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53