How to programmatically hide Imageview

How to programmatically hide Imageview

I have a linearlayout with three icons as below

I have a linearlayout with three icons as below

 <ImageView
            android:id="@+id/cities"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content          
            android:src="@drawable/city" />

    &lt;ImageView
        android:id="@+id/red"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"           
        android:src="@drawable/red"
        android:visibility="gone" 
        /&gt;
    &lt;ImageView
        android:id="@+id/deal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"       
        android:src="@drawable/deal" /&gt;

initially the middle icon is hidden (android:visibility="gone") I have a login screen..when the login i success I want the icon to be visible ..tried as below..but itz not working

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

setContentView(R.layout.fyelogin);                    
etPassword = (EditText)findViewById(R.id.password);
btnLogin = (Button)findViewById(R.id.login_button);
btnCancel = (Button)findViewById(R.id.cancel_button);
lblResult = (TextView)findViewById(R.id.result);

final ImageView details = (ImageView)findViewById(R.id.red); 

btnLogin.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {

        String password = etPassword.getText().toString();

        if(password.equals("guest")){
            lblResult.setText("password successful.");

giving error @ this line  -----&gt;  details.setVisibility(View.VISIBLE);

        } else {
            lblResult.setText("password doesn't match.");
        }

        finish();
    }
});


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Android App Development Company in UAE

Have a plan to build an robust Android App Development with multiple features? We at Data EximIT is one of the best **[Android App Development Company in UAE](https://www.dataeximit.com/android-application-development/ "Android App Development...

Kotlin Coroutines on Android - How to use Coroutines on Android

Coroutines are a Kotlin feature that convert async callbacks for long-running tasks, such as database or network access, into sequential code. This Kotlin Coroutines tutorial will show you how to use coroutines on Android, and how the new androidx-concurrent library makes it easy to use them to get things off the main thread. You'll also learn how the new library helps coroutines work with Architecture Components. This session also covers coroutine patterns, best practices, and even how to test coroutines!

Best Android App Development Company New York

Are you looking for the [Best Android App Development Company in New York](https://www.appcluesinfotech.com/android-app-development-company/ "Best Android App Development Company in New York")? if yes? then you have come to the right place....