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 6934559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:58:33+00:00 2026-05-27T11:58:33+00:00

i am working on android. i am creating a login button. i want that

  • 0

i am working on android.

i am creating a login button. i want that whenever i press login button then text color of that button should be changed.

and when this button pressed then login functionality should be performed.

for this i am coding like this:-

button_login.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View arg0, MotionEvent arg1) {

    // TODO Auto-generated method stub
    int action = arg1.getAction();
    if(action == MotionEvent.ACTION_DOWN) {                          
          button_login.setTextColor(Color.parseColor("#163D74"));
          return true;
    } else if (action == MotionEvent.ACTION_UP) {
          button_login.setTextColor(Color.parseColor("#FFFFFF"));
                  return true;
    }
         return false;

    }
 });        
button_login.setOnClickListener(new Button.OnClickListener() {

    @Override

        public void onClick(View v)
            {
    // checking the functionality of login

             }
           });

but only onTouchListener is working. login functionality is not working.

please suggest me what mistake i have done. and how can i implement these both functionalities. means how can i change the color of text of button and how can i perform login functionality.

Thank you in advance.

  • 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-27T11:58:34+00:00Added an answer on May 27, 2026 at 11:58 am

    You should just declare your login functionality when action is UP.

    button_login.setOnTouchListener(new View.OnTouchListener() {
    
            @Override
    
            public boolean onTouch(View arg0, MotionEvent arg1) {
    
                // TODO Auto-generated method stub
    
                int action = arg1.getAction();
    
                if(action == MotionEvent.ACTION_DOWN) {
    
                      button_login.setTextColor(Color.parseColor("#163D74"));
    
                    return true;
    
                } else if (action == MotionEvent.ACTION_UP) {
    
                       // check logine functionality.
                      button_login.setTextColor(Color.parseColor("#FFFFFF"));
    
                    return true;
    
    
                }
    
                return false;
    
            }
    
        });
    

    Its does the same thing with the same logic.

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

Sidebar

Related Questions

Currently I am working on an Android application that is dynamically creating controls. Everytime
I am working in android, i want to make a scrollview. this is my
I'm working on creating an android app, and I've found that many classes and
I am working in android. I want to parse my json data. This is
I am working on an Android app that utilizes the Google Maps API MapView,
I am working on an Android app that has multiple screens the user will
I have been working on a Android Web Services program that uses a number
I'm working on connecting an android app in Java with google app engine. This
I am working on a shopping cart application for Android. While creating package design,
I'm creating an Android application (Android 2.3.3) that has a header, a footer and

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.