I get an error when I call findViewWithTag() in the onCreate()
“The method
findViewWithTag(String)is undefined for the type
MainActivity”
Is there any alternative?
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.
findViewWithTag()is only defined for a View.If you have a reference to the contentView of the activity that you set with
setContentView(contentView), you can usecontentView.findViewWithTag().If you don’t have a reference to that view, you can also use
findViewById(R.id.your_content_view_id).findViewWithTag(tag).