1

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

2 Answers2

2

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

Michael Dodd
  • 10,102
  • 12
  • 51
  • 64
1

Can We use string resources for code comment in android?

No You can't

Comments are just ignored by compiler and never get executed.

V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50