setup TextView State - Android User Interface

Android examples for User Interface:TextView

Description

setup TextView State

Demo Code


import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.TextView;

public class Main{
    public static void setupTextViewState(TextView tvCount,
            TextView tvDone, int selectedCount) {
        if (tvCount != null) {
            tvCount.setVisibility(selectedCount > 0 ? View.VISIBLE
                    : View.GONE);
            tvCount.setText(String.valueOf(selectedCount));

            if (selectedCount != 0)
                tvCount.startAnimation(AnimationUtils.loadAnimation(
                        tvCount.getContext(), R.anim.pi_anim_scaler));
        }//from  w  w  w  .  j  av  a 2s .c  o  m

        if (tvDone != null) {
            tvDone.setEnabled(selectedCount > 0);
        }
    }
}

Related Tutorials