Can We use string resources for code comment in android?

262 views Asked by At

Suppose we have some statement for comments which will be repeat many times. Can We use string resources for code comment in android?

2

There are 2 answers

1
Michael Dodd On BEST ANSWER

No. Comments are ignored by the compiler and runtime engine, therefore there would be no point in referring to a String resource. If you are looking to create the same comment over and over in the source code, recording a macro in Android Studio will do the job better:

Edit -> Macros -> Start Recording Macro

Type out your comment

Edit -> Macros -> Stop Recording Macro

Give your macro a name. Then to use your macro again:

Edit -> Macros -> Play saved macro...

You can also map your macro to a key combination via:

File -> Settings -> Keymap -> Macros

1
V-rund Puro-hit On

Can We use string resources for code comment in android?

No You can't

Comments are just ignored by compiler and never get executed.