Should View components like Buttons, Edittexts, Textview, etc. be static or not (Android Studio) Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Should View components like Buttons, Edittexts, Textview, etc. be static or not (Android Studio) without wasting too much if your time.

The question is published on by Tutorial Guruji team.

Can someone explain me if it’s better to have Buttons and other components in Android Studio as static attributes or is it better to have these as just normal attributes, when you look at an activity that is only used once at a time?

Answer

You wouldn’t want to use views in static variables cause when activities are recreated they will be destroyed and your static views will still hold your destroyed context. This will cause lots of bug in application and is considerably very bad tactic and not even that much useful.

We are here to answer your question about Should View components like Buttons, Edittexts, Textview, etc. be static or not (Android Studio) - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji