Extract all hardcoded strings to string resource

前端 未结 4 2214
温柔的废话
温柔的废话 2020-12-05 15:15

I know there is Alt + Enter combination to extract single String to string resource. But I am wondering is there anything that I can extract all string

4条回答
  •  忘掉有多难
    2020-12-05 15:38

    As your requirements and as I know there is no such feature in android studio you were really searching for, But here are some alternative ways that can help you.

    • Go to "Analyze > Run Inspection ..", and type "Hardcoded strings". Run that in your whole project, and you will get an inspection results panel that will show all the hardcoded text of projects. Then hit Alt + Enter and you'll get an option to automatically extract that Strings.

    • Another approach is to Find and Replace But It's not better because of time consumption. To simplify the approach you can have a look at here for flexibility.

提交回复
热议问题