Search For A Text String Android Studio Mac

Active1 year, 9 months ago

I need to find and extract all hard coded strings in my project in Android Studio (beta) 0.84.I need a static analysis tool like Find Bugs do this for me in one shot and allow me to step through each message and extract the string to resource files. Even better would be if the entire process is automated.

The Translations Editor showing app text before translation. String resources. Decide if you want a safe delete and whether you want to search in comments and strings, and click OK. Manage and test localizable text. The Android platform and Android Studio provide several features to help you manage and test your localizable app text.

In Android Studio (beta) 0.84 the File / Setting /FindBugs-IDEA shows I18N as an option under Reporting tab.But I just cannot figure out how to make it work.

Mac

Thanks for any suggestions.

Farrukh NajmiFarrukh Najmi
2,5772 gold badges23 silver badges39 bronze badges

5 Answers

As @Maor Hadad and other upvotes suggested me : I convert my comment in an answer, so :

Since Android Studio 1.2.2, there is a new option in 'Analyse > Run inspection By Name' => 'Hardcoded strings'. I used it and it seems quite more reliable with current version than 'hardcoded text' (that checks only xml files).

Seen here link

PADPAD

Go to 'Analyze > Run Inspection By Name...', and type 'Hardcoded text'. Run that one against your whole project, and you should get an inspection results panel that will show the hardcoded text instances.

You can also go to Android Studio > Preferences > Inspections > Hardcoded text and specify exactly how it runs, and what (if any) special cases are excluded from inspection.

kcoppockkcoppock
117k40 gold badges232 silver badges253 bronze badges

For Windows platform, The best way I found is this:

You can use this shortcut CtrlAltShiftI and search for,

Hardcoded Text

in the search bar.

You can select appropriate module in which you want to search Hardcoded strings and it will give you the list of all Strings together.

TapanHPTapanHP
2,9574 gold badges25 silver badges49 bronze badges

If you just want to find all the hard coded strings in all the layout files only, you can do so very quickly by running -

Notes -
1. grep can't be used on windows
2. First cd to project's layout dir
3. kcoppock answer is great, but it takes too much time

Vinayak GargVinayak Garg
3,6338 gold badges44 silver badges72 bronze badges

Use Ctrl + Shift + F combination for Windows to search everywhere, it shows preview also.

Use Ctrl + F combination for Windows to search in current file.

Use Shift + Shift (Double Shift) combination for Windows to search Project File of Project.

May be unavailable for older versions.

How To Search Outlook For A Text String

user392117user392117
2,0864 gold badges20 silver badges37 bronze badges

Not the answer you're looking for? Browse other questions tagged androidinternationalizationandroid-studio or ask your own question.

Active1 year, 5 months ago

In Android Studio (IntelliJ) how do you execute a 'File Search' for a string within a Scope of files? Can Search Everywhere do this, I only see how to use it to search 'code', not 'files'

Example: Search for the string 'Dummy Button' in the 'Workspace Scope'.

Expected Response:res/values/string.xml:line4

J-Dizzle
J-DizzleJ-Dizzle
2,2493 gold badges26 silver badges39 bronze badges

5 Answers

You can do it in two ways,

Goto Menu -> Edit -> Find -> Find in Path

Or use the shortcut,

ctrl+shift+f

Sajeetharan - MSFTSajeetharan - MSFT
140k33 gold badges210 silver badges269 bronze badges

Try this. Enter your string name in dialogue box after pressing ctrl+shift+f

TauqirTauqir
1,5501 gold badge13 silver badges39 bronze badges

In Android Studio,

  1. On a Windows or Linux based machine use shortcut Ctrl + Shift + F to search any string in whole project. It's easy to remember considering Ctrl + F is used to search in the current file. So just press the Shift as well.

  2. On OSX use the Command key instead of Ctrl.

  3. Use Ctrl + F combination for Windows and Linux to search in current file.

  4. Use Shift + Shift (Double Tap Shift) combination for Windows and Linux to search Project File of Project.

  5. Command+Shift+F on Mac to find in path

Developer Guy
1,6835 gold badges15 silver badges27 bronze badges
Karan sharmaKaran sharma
J-DizzleJ-DizzleAndroid
2,2493 gold badges26 silver badges39 bronze badges

Search For A Text String Android Studio Mac Os

Press Two times Shift button and write in search box it will search in whole Android studio.

Raj TurakhiaRaj Turakhia

Search For A Text String Android Studio Mac

Not the answer you're looking for? Browse other questions tagged androidandroid-studio or ask your own question.