Using android studio, How can I make 2 buttons name (submit) and (next page) but make the (next page) button unclickable. Then make it clickable after the (submit) button was clicked.
Asked
Active
Viewed 277 times
-5
-
1show code what you have done? – Abhinav Gupta Mar 08 '18 at 06:43
-
show some efforts – Aj 27 Mar 08 '18 at 06:44
-
use button.setenable(true) in onclik of submit butoon. – Juturu Yugandhar Mar 08 '18 at 06:47
-
6Possible duplicate of [How to disable an Android button?](https://stackoverflow.com/questions/4384890/how-to-disable-an-android-button) – Alex Mar 08 '18 at 06:48
3 Answers
4
Use this
Button submit, next;
submit= (Button) findViewById(R.id.submit);
next= (Button) findViewById(R.id.next);
next.setEnabled(false);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
next.setEnabled(true);
}
});

Syed
- 166
- 3
- 15
-
You really really helped me out thanks alot...you had the best answer for me – Rayjun Reed Mar 08 '18 at 10:35
-
Is it possible if you can show me how to hide an unclickable button. – Rayjun Reed Mar 14 '18 at 15:30
-
1
You can use Clickable property as false and change it after clicking submit button.
Button submitButton, nextButton;
boolean b = false;
submitButton= findViewById(R.id.submitButton);
nextButton = findViewById(R.id.nextButton)
nextButton.setClickable(false);
submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
nextButton.setClickable(true);
}
});

Rifat
- 1,700
- 3
- 20
- 51
0
- how can I make 2 buttons name (submit) and (next page) :- using xml create two buttons
<Button android:id="@+id/next_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Next" android:layout_gravity="center_horizontal" android:textAllCaps="false"/>
- But make the (nextpage) button unclickable :- In your MainActivity.java with
Button next =(Button) findViewById(R.id.next_button); next.setEnabled(false);
- Then make it clickable after the (submit) button was clicked :-
btn_Submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { next.setEnabled(true); } });
Hope this helps. No question is a bad question. Cheeers! Reply if any doubts.

sanjeev
- 1,664
- 19
- 35