Md Afsar
Md Afsar

Reputation: 5

hardcoded warning in emulator

I am getting this warning:

hardcoded string "button name" should use @string resource

What does it mean? Is there any problem (specially related to gps) in the app, if I leave it as it is?

Here is the button:

android:id="@+id/retrieve_location_button"
android:text="Retrieve Location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

Upvotes: 0

Views: 460

Answers (1)

freeone3000
freeone3000

Reputation: 384

It means that your button's layout XML should look like:

<button android:id="@+id/retrieve_location_button" android:text="@string/location_text" android:layout_width="wrap_content" android:layout_height="wrap_content">

Where your strings.xml would have:

<resources>
    <string name="location_text">Retrieve Location</string>
</resources>

This is an internationalization and translation issue, not something that would affect the runtime of the program. You should externalize user-visible strings so that your application can be translated.

Upvotes: 2

Related Questions