Code example for AnimationDrawable

0
    } 
 
    public BootanimationImageView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        mOpts = new BitmapFactory.Options();
        mAnimation = new AnimationDrawable();
    } 
 
    public void loadAnimation(String path) throws IOException {
        ZipFile zip = new ZipFile(path);
        ZipEntry entry = zip.getEntry("desc.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(zip.getInputStream(entry)));
        // first line, 3rd column has # of frames per second 
        mFrameRateMillis = 1000 / Integer.parseInt(reader.readLine().split(" ")[2]);
        String line = "";
        mAnimationParts = new ArrayList<AnimationPart>();
        while ((line = reader.readLine()) != null) {
            String[] info = line.split(" ");
            if (info.length == 4 && info[0].equals("p")) {
                int playCount = Integer.getInteger(info[1], 1);
                int pause = Integer.getInteger(info[2], 0);