Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 192673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:26:44+00:00 2026-05-11T16:26:44+00:00

I use onLongClick and onClick events of a button to get user inputs. Whenever;

  • 0

I use onLongClick and onClick events of a button to get user inputs. Whenever; the user long click and triggers onLongClick event, the onClick event is also triggered. I couldn’t find my problem. The code of two methods are shown in below:

@Override
    public void onClick(View v) {
        switch(((Button) v).getId())
        {
        case R.id.enter:
            EntertheNumber();
            break;
        case R.id.clear:
            CleartheNumber();
            break;
        case R.id.number_zero:
        case R.id.number_one:
        case R.id.number_two:
        case R.id.number_three:
        case R.id.number_four:
        case R.id.number_five:
        case R.id.number_six:
        case R.id.number_seven:
        case R.id.number_eight:
        case R.id.number_nine:
            AddtotheNumber(mEditor, (Button) v);
            break;
        }
@Override
    public boolean onLongClick(View view) {
        if(SMBGuesstheNumber.bDisplayFlagList)
        {
            theActiveButton = (Button) view;
            showDialog(R.id.display_flaglist);
        }
        return false;
    }

Actually, my project is Open Source. So, you can find all the code at http://code.google.com/p/guessthenumber/

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:26:44+00:00Added an answer on May 11, 2026 at 4:26 pm

    I’m not sure what order these events occur but the onLongClick handler returns a bool to indicate whether the event was handled. You should return true if you handled it so that other click events will not be called. I don’t know if this will prevent prevent the onClick() from firing though.

    You may also turn these events off and on using setClickable(boolean) and setLongClickable(boolean)

    You can find this information and more about UI events here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Use Case Show a photo uploaded by the user in a square box with
In Android, I'm trying to capture user touches as well as User long-touches. I
Use Case: End-User searches for something and an ArrayCollection is returned with Result objects.
use Control::CLI; $cli = new Control::CLI('SSH'); $cli->connect(Host=>'10.10.10.10',Username=>'user',Password=>'pwd'); $cli->waitfor('>'); $cli->print('Show XXXXXXXXXXXXXXXXXXXX| grep Active'); @f=$cli->waitfor('>'); print
use WWW::Mechanize; my $mech = WWW::Mechanize->new; $mech->get( $url ); say $mech->text; How could I
Use case: User launches app The user enters google password The app lets the
Use Case: Admin should be able to create user, and it should not attempt
Use OPENXML to get dt element in MSSQL 2005. How can I get xmlns:dt
In our application, we handle the events in a button to record data. So
Use: The user searches for a partial postcode such as 'RG20' which should then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.