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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:49:52+00:00 2026-05-30T03:49:52+00:00

Can someone tell me how to disable a button in Android unless all three

  • 0

Can someone tell me how to disable a button in Android unless all three editText fields are filled? I’m not sure where to include a conditional statement here and how to place it in the context of the button listener.

Here’s my main activity code.

package com.amritayalur.mypowerschool;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;



public class MyPowerSchoolActivity extends Activity {
Button buttonSubmit;
TextView textViewTitle;
TextView textViewDesc;
EditText editTextURL, editTextUser, editTextPass;

String url = "";
 String str;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    buttonSubmit = (Button) findViewById(R.id.buttonSubmit);
    textViewTitle = (TextView) findViewById(R.id.textViewTitle);
    textViewDesc = (TextView) findViewById(R.id.textViewDesc);

    editTextURL = (EditText) findViewById(R.id.editTextURL);
    editTextUser = (EditText) findViewById(R.id.editTextUser);
    editTextPass = (EditText) findViewById(R.id.editTextPass);
    //Start TextView
    textViewTitle.setText("MyPowerSchool");


    //button listener
    buttonSubmit.setOnClickListener(new View.OnClickListener() {


        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent i = new Intent( MyPowerSchoolActivity.this, creds.class);    
            i.putExtra("pschoolurl", editTextURL.getText().toString());
            i.putExtra("pschooluser", editTextUser.getText().toString());
            i.putExtra("pschoolpass", editTextPass.getText().toString());
            // get the text here
            final int result = 1;
            startActivityForResult(i, result); 

        };




    });




}       
}
  • 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-30T03:49:55+00:00Added an answer on May 30, 2026 at 3:49 am

    Its very Simple, Just update your onClick() method with following code,

        @Override
        public void onClick(View v) 
        {
            if (  ( !editTextURL.getText().toString().equals("")) && ( !editTextUser.getText().toString().equals("")) && ( !editTextPass.getText().toString().equals("") ) ) 
            {
                 // TODO Auto-generated method stub
                Intent i = new Intent( MyPowerSchoolActivity.this, creds.class);    
                i.putExtra("pschoolurl", editTextURL.getText().toString());
                i.putExtra("pschooluser", editTextUser.getText().toString());
                i.putExtra("pschoolpass", editTextPass.getText().toString());
               // get the text here
               final int result = 1;
               startActivityForResult(i, result); 
            }
        };
    

    The Above if condition will not disable your Button , but it will allow only if your All EditText are not empty.

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

Sidebar

Related Questions

Can someone tell me why this is not working: <button class=btn danger id=delete onclick=return
Can someone tell me why this processes all the files and then does it
Can someone tell me how to tell Wordpress' tinymce editor to NOT strip out
Can someone tell me why the following does not match: >>> re.search(r'(\d{2, 10})', '153')
can someone tell me what i am doing wrong here.. i am not getting
Can someone tell me, as to why program1's signal handler is not working? Program1:
Can someone tell me the location of drivers (specifically camera drivers) in Android System
Can someone tell me available options for web servers in android(even different type of
Can someone tell me why the following css is not validating? I've been trying
Can someone tell me how to set my X button in main application window

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.