How to find a view in a class extended from Fragment or ListFragment? If I try
Button newItemBtn = (Button)getView().findViewById(R.id.bt_add_item);
I do not receive my view back, meaning it was just not found. How to find it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The answer is that you have to do it in
onActivityCreated()method, not inonCreate().