---
title: "How to hide and show editText?"  
description: "How to hide and show editText?"  
author: "Anonymous User"  
published: 2014-10-14  
updated: 2014-10-14  
canonical: https://www.mindstick.com/forum/2381/how-to-hide-and-show-edittext  
category: "android"  
tags: ["android", "mobile development"]  
reading_time: 1 minute  

---

# How to hide and show editText?

I have an editText([hidden](https://www.mindstick.com/forum/2303/skip-validating-field-from-hidden-div) by [default](https://www.mindstick.com/interview/12771/what-is-the-importance-of-default-resources)) and a [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net). I want to show the editText on [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) of the button and hide when the button again is pressed. Also the editText should hide if the editText box loses focus. How can this be done? Thank you for the help in advanced.

## Replies

### Reply by Anonymous User

You can use like this And the main concept here is editText.setVisibility(View.GONE).\

```
Button button = (Button) findViewById(R.id.button);        final EditText editText = (EditText) findViewById(R.id.edittext);        button.setOnClickListener(new OnClickListener() {            @Override            public void onClick(View v) {                if(editText.getVisibility()==View.VISIBLE){                    editText.setVisibility(View.GONE);                } else {                    editText.setVisibility(View.VISIBLE);                }            }        });
```


---

Original Source: https://www.mindstick.com/forum/2381/how-to-hide-and-show-edittext

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
