how to save the touched view in a variable?

Can I save the state of the view when it is touched?

  • I want to save the state of a view when it is touched. For example when I touch a view and after that I touched the another view in an activity I should be able to change the color of both the textviews at once. For this I need to save the state of the view which is touched at first. Is it possible?

  • Answer:

    What do you mean "save state"? For your purpose you need save only id of first view and get it later by calling findViewById(savedId).

Sohaib Rahman at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.