问题
I have an app on forein language and I want to traslete it fully for example in the smali file I have this programming code:
const-string v1, "Hello"
How I can add reference to the string.xml file from this smali code?
回答1:
If you need to do it in com.xxx.yyy.HomeActivity, and your localized string'id in R.java is 0x7f050000. Use the code below to replace the code const-string v1, "Hello"
invoke-virtual {p0}, Lcom/xxx/yyy/HomeActivity;->getResources()Landroid/content/res/Resources;
move-result-object v2
const/high16 v3, 0x7f050000
invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;
move-result-object v1
来源:https://stackoverflow.com/questions/38565350/how-to-do-localization-in-smali-files