Reputation: 33
I tried to use setContentView in this fragment. But this is not possible. I would like to know why? and how i can fix this problem?
my destination is to open a new view, if the login is right. I hope u understand what i mean.
package de.ibers.coffeelist;
if (isValid) {
Button buttonLogin = (Button)rootView.findViewById(R.id.btn_login);
buttonLogin.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText pinEdit = (EditText) getView().findViewById(R.id.et_pin);
String inputPin = pinEdit.getText().toString();
if(inputPin.equals(_pin)) {
setContentView(R.layout.buyview);
}
else {
Log.d("buttonLogin ", "faild");
}
}
});
Upvotes: 0
Views: 2188
Reputation: 1534
Override onCreateView method in fragment.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.buyview, container, false);
}
Upvotes: 2