Trying To Create Imageview When Click The Button
I am trying to create ImageView when I click the button.I don't know why when I am creating it I get the error on new Image. the code I am working is as follows: @Override protecte
Solution 1:
I don't know that you posted wrong or right or typing mistake but according to your code it should be
ImageViewimage=newImageView(activity_main,this);
to
ImageViewimage=newImageView(activity_main.this);
also you can use
image.setImageResource(R.drawable.element_wall);
instead of
image.setBackgroundResource(R.drawable.element_wall);
Solution 2:
Please check the constructor of ImageView here
Your code should look like:
ImageViewimage=newImageView(<YourActivityClass>.this);
Post a Comment for "Trying To Create Imageview When Click The Button"