segue_segway
segue_segway

Reputation: 1518

If I change ID of an element in Android Studio, how do I carry on this change throughout the code?

For example, say I'm using a relative layout and a lot of views are centered around a TextView with ID of TextView. If I change this ID to TextView1, the other elements referencing it all break. How can I change the ID so that the changes are carried out?

Thanks in advance!

Upvotes: 2

Views: 1870

Answers (2)

N J
N J

Reputation: 27515

Select what you want to refactor

for windows

Press Shift+f6 do refactor

for Mac

press Shift+fn+F6 do refactor

Upvotes: 2

RyuZz
RyuZz

Reputation: 581

You can easily replace all ID's in one step, just press strg+r on windows.

In the first text field put in your old ID and in the second one the new ID, press Replace all and you're done.

Upvotes: 1

Related Questions