Well the view you are looking for is in your fragment's layout, so you should handle that view inside your fragment.
Option A:
remove all EditText-related code from your Activity onCreate method. Create fields watcher and editText1, editText2 inside the Fragment. So your PlaceholderFragment code should look more or less like this:
public static class PlaceholderFragment extends Fragment {
EditText editText1, editText2;
public TextWatcher watcher = new TextWatcher(){
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
checkFieldsForEmptyValues();
}
@Override
public void afterTextChanged(Editable editable) {
}
};
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container,
false);
editText1 = (EditText) rootView.findViewById(R.id.editTitle);
editText1.addTextChangedListener(watcher);
editText2 = (EditText) rootView.findViewById(R.id.editCredit);
editText2.addTextChangedListener(watcher);
return rootView;
}
}
Option B:
Since it looks like your fragment is the autogenerated one from eclipse and you may not want to use fragments in your code you can do this: Drop your fragment code & layout and move the edittexts from your fragment layout in to your activitiy layout. Then your onCreate code of the Activity should work.