---
title: "Status not changing on button press in android"  
description: "Status not changing on button press in android"  
author: "Anonymous User"  
published: 2014-11-18  
updated: 2014-11-19  
canonical: https://www.mindstick.com/forum/12633/status-not-changing-on-button-press-in-android  
category: "android"  
tags: ["java", "onclicklistener"]  
reading_time: 1 minute  

---

# Status not changing on button press in android

Whenever I presses the [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net), it should change [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions), and also change [boolean](https://www.mindstick.com/forum/160332/how-does-the-boolean-function-work) [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages), yet this is not working. Any help? Thnks

Before onCreate:

```
public boolean status = false;Button Click:case R.id.saveButton:   if (status != true) {    currentStatus.setText("Current status: In need of help!");    status = true;}if (status != false) {    currentStatus.setText("Current status: Fine.");    status = false;}break;
```

## Replies

### Reply by Anurag Sharma

```
if(status){       currentStatus.setText("Current
status: Fine.");       status = false;}else {                                    currentStatus.setText("Current
status: In need of help!");       status = true}
```

or using ternary operator :

currentStatus.setText(status ? "Current status: Fine." : "Current status: In need of help!");

status = !status;//toggle boolean value


---

Original Source: https://www.mindstick.com/forum/12633/status-not-changing-on-button-press-in-android

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
