I have this code:
if (!errors.isEmpty()) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, errors, duration);
toast.show();
} else {
// Success! Cache the inputs and continue with registration.
SharedPreferences settings = getSharedPreferences("settings", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("name", name);
editor.putString("email", email);
editor.putString("password", password);
Intent i = new Intent(view.getContext(),
sendRegisterActivity.class);
startActivityForResult(i, 0);
}
Now, this is within a public void sendRegistration(View view) which is fired on the click of a button. Whenever I take away the last 3 lines of the “else” statement it works. But when I add it, I get “Source could not be found”. sendRegisterActivity.java exists but still I’m getting errors. This is how sendRegisterActivity looks:
public class sendRegisterActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sendregister);
}
}
sendregister.xml is within the “layout” folder, and is completely valid.
Have you added sendRegisterActivity to your manifest?