31
public class main extends Activity {

    EditText username,password1;
    Button sub;
    String uname,pass;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        sub = (Button) findViewById(R.id.btn_submit);
        sub.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                username = (EditText) findViewById(R.id.uname);
                password1 = (EditText) findViewById(R.id.editText2);
                uname = (String) username.getText().toString();
                pass = (String) password1.getText().toString();

                if (uname.equalsIgnoreCase("uname"))
                    if (pass.equalsIgnoreCase("pass"))
                        Toast.makeText(main.this, "user is authenticated", Toast.LENGTH_LONG).show();
                    else
                        Toast.makeText(main.this, "Password Invalid", Toast.LENGTH_LONG).show();
                else
                    Toast.makeText(main.this, "User or Password Invalid", Toast.LENGTH_LONG).show();
            }
        });
    }
}

code showing the following error..

res\layout\Contact_us.xml: Invalid file name: must contain only [a-z0-9_.]
SilentKiller
  • 6,944
  • 6
  • 40
  • 75

6 Answers6

76

Try removing the capital letter. res\layout\contactus.xml

Jainendra
  • 24,713
  • 30
  • 122
  • 169
Iker
  • 2,018
  • 2
  • 29
  • 52
11

You need to use lowercase letters. You have 'C' you must rename it to contact_us.xml.

Ovidiu Latcu
  • 71,607
  • 15
  • 76
  • 84
9

Make C to c. Use lower case letters and no symbols

Nikola Despotoski
  • 49,966
  • 15
  • 119
  • 148
4

using lower case letters and clean the package

kranti
  • 93
  • 2
  • 9
2

it should be contactus.xml, You should follow below listed naming convention:

File name must contain only lowercase a-z, 0-9, or _.

only a-z,mind that not capital...and white-space not allowed

name must start with a character.not with a Number(0-9)

name only _ symbol allowed.no other symbol alowed.
surhidamatya
  • 2,419
  • 32
  • 56
0

try naming xml layout with small letters. worked for me Contact_us.xml change this to contact_us.xml

Mudasar
  • 159
  • 1
  • 7