@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.team, container, false); View v = rootView.findViewById(R.id.btn_login); username = (EditText) rootView.findViewById(R.id.username); password = (EditText) rootView.findViewById(R.id.password); cb = (CheckBox) rootView.findViewById(R.id.savePwd); cb.setOnClickListener(this); synchronized (ActionMainActivity.class) { if (ActionMainActivity.isStored()) { username.setText(ActionMainActivity.getUsername()); // username.setVisibility(View.INVISIBLE); password.setText(ActionMainActivity.getPassword()); password.setVisibility(View.INVISIBLE); cb.setChecked(true); } } if (v != null) v.setOnClickListener(this); return rootView; }