November 26, 2017

How to Blink Text in android

Use the Method in side CreateView / OnResume


private void blink(){
        final Handler handler = new Handler();
        new Thread(new Runnable() {
            @Override
            public void run() {
                int timeToBlink = 1000;    //in milissegunds
                try{Thread.sleep(timeToBlink);}catch (Exception e) {}
                handler.post(new Runnable() {
                    @Override
                    public void run() {

                        if(mobiletext.getVisibility() == View.VISIBLE){
                            mobiletext.setVisibility(View.INVISIBLE);
                        }else{
                            mobiletext.setVisibility(View.VISIBLE);
                        }
                        blink();
                    }
                });
            }
        }).start();
    }

No comments:

Post a Comment