Consider you have set the source for the ImageView in your xml as below,
To change the image source programatically,<ImageViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/myImgView"android:src="@drawable/something"/>
or,myImgView.setImageResource(R.drawable.ball);
myImgView.setImageDrawable(getResources().getDrawable(R.drawable.ball));
No comments:
Post a Comment