EditText editText = findViewById(R.id.editText); editText.setHint("Enter your name");
EditText editText = findViewById(R.id.editText); editText.setHint(R.string.name_hint);In this example, we're setting a hint text with the resource id R.string.name_hint. This allows us to define the hint text in a separate string resource file, making it easier to modify or localize the text without modifying the code. Package library: The EditText widget is part of the Android framework and is located in the android.widget package.