Well, my program has been working so far, staying compilable and everything, and I tried to add a sound to it, so I created a folder "raw", and stuck in the mp3 file. Then I tried to use it, and everything started getting errors for whatever reason. I Ctrl+Z'd until it was back to before I tried adding sound. The program still error'd. I deleted the raw folder and there's still errors[marked in the program below] Note that this is only 1 class from my program, there are others.
package scouting.form;
import android.R;//Don't use android.R here; use a fully qualified name for each usage instead - this one only comes up *sometimes...*
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Login extends Activity {
Button login;
EditText user;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);//Error: activity_login cannot be resolved or is not a field
login=(Button) findViewById(R.id.button1);//NO ERROR even though the next line has an error...
user=(EditText) findViewById(R.id.editText1);//Error: editText1 cannot be resolved or is not a field
login.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent openScouting = new Intent("com.cody.graham.SCOUTING");
startActivity(openScouting);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_login, menu);//Error: activity_login cannot be resolved or is not a field
return true;
}
}
I know that the layouts and menus are still there, they have been there the whole time, I can open the layouts and confirm that there is still an Edit Text box in the layout "activity_login" which is in the layout folder and the edit text box does have the line
android:id="@+id/editText1"
in it.
See at the top?
import android.R;//Don't use android.R here; use a fully qualified name for each usage instead - this one only comes up *sometimes...
You should probably heed what that comment says. ;) Remove the import for android.R
, and it will use your project's R
file instead, which is where activity_login
is.