Android dynamic change image resource (안드로이드 동적 이미지 변경)

안드로이드 소스코드 내에서의 동적 이미지 변경 방법입니다.

setImageResource(getApplication().getResources().getIdentifier(String name, String defType, String defPackage));

위와같은 방식으로 가져오며, 아래는 소스코드의 예 입니다.

imageView image= (ImageView)findViewById(R.id.test_image);
image.setImageResource(getApplication().getResources().getIdentifier("ic_launcher", "mipmap", "com.testcode.testproject"));

이런 방식으로 소스코드 내에서 이미지를 변경 할 수 있습니다.