Tried everything like cleaning the project,installing SDK build tools,checking for errors in XML layout files. Still no way I can get rid of this "unexpected R error".
Below is the code for First.java
package com.example.wctm;
import android.os.Bundle;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class First extends Activity implements OnClickListener {
EditText name;
EditText pass;
Button submit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
name=(EditText)findViewById(R.id.editText1);
pass=(EditText)findViewById(R.id.editText2);
submit=(Button)findViewById(R.id.button1);
submit.setOnClickListener((android.view.View.OnClickListener) this);
}
public void onClick(View v)
{
String na=name.getText().toString();
String pa=pass.getText().toString();
switch (v.getId()) {
case R.id.button1:
if(na.equals("wctm") && (pa.equals("wctm")))
{
Intent i=new Intent(this,Second.class);
startActivity(i);
}
break;
default:
break;
}
}
enter code here
@Override
public void onClick(DialogInterface arg0, int arg1) {
}
}