EditText editText = new EditText(context); editText.setTextColor(Color.RED);
EditText editText = new EditText(context); editText.setTextColor(R.color.blue);
EditText editText = (EditText) findViewById(R.id.editText); editText.setTextColor(Color.GREEN);Package Library: android.widget Note: The findViewById() method is used to locate the view by its unique ID. The ID is set in the XML layout file.