I have created my Login form in xml to my liking and my shared preference does work, but when I add full screen to the java class the app crashes out. Here is my code, any help would be thankful.
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
/*
* Check if we successfully logged in before.
* If we did, redirect to home page
*/
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
if (settings.getString("logged", "").toString().equals("logged")) {
Intent intent = new Intent(Password.this, Video.class);
startActivity(intent);
}
Button b = (Button) findViewById(R.id.loginbutton);
b.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
EditText username = (EditText) findViewById(R.id.username);
EditText password = (EditText) findViewById(R.id.password);
if(username.getText().toString().length() > 0 && password.getText().toString().length() > 0 ) {
//------------------------------------Username below -------------------------------------Password below ---//
if(username.getText().toString().equals("username") && password.getText().toString().equals("password")) {
/*
* So login information is correct,
* we will save the Preference data
* and redirect to next class / home
*/
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("logged", "logged");
editor.commit();
Intent intent = new Intent(Password.this, Video.class);
startActivity(intent);
}
}
}
});
}
}