I want to do Frame Animation with 30 frames. My code for the same is:
animation = new AnimationDrawable();
for (int i= 1; i<= 30 ; i++){
frame= "xyz"+ i;
resource = this.getResources().getIdentifier(frame, "drawable", "com.example.frameanimation");
Log.e("123", "resource value======"+resource+"============"+frame);
animation.addFrame(getResources().getDrawable(resource), 50);
System.gc();
}
animation.setOneShot(false);
In this code I have included System.gc();
. Will this help me in optimizing in memory related issues. Or it can still give memory related issues. And does this mean that 30 images which are present in memory while frame animation will be destroyed.?
Is there any other way to optimize this? Suggestions please.
Thanks in Advance.