In my sub class I am trying to add an image View:
ImageView image = new ImageView(this);
But it breaks the app. I think it is because of the ‘this’ param.
Does my class need to extend something? At the minute it extends Activity.
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.
You can do that but you need to provide
this.ApplicationContextinstead ofthis. Alternatively you could derive a View instead of an Activity and use constructor’sContextargument for the ImageView constructor.