Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.app.Activity;

import android.support.annotation.AnimRes;

import android.view.View;

import android.view.animation.AnimationUtils;

public class Main {
    public static void showViewWithAnim(final View view, @AnimRes final int anim, final int delay) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                sleep(delay);

                ((Activity) view.getContext()).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        view.setVisibility(View.VISIBLE);
                        view.startAnimation(AnimationUtils.loadAnimation(view.getContext(), anim));

                    }
                });
            }
        }).start();
    }

    private static void sleep(int millis) {
        try {
            Thread.sleep(millis);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}