populate TextView by message - Android User Interface

Android examples for User Interface:TextView

Description

populate TextView by message

Demo Code


//package com.java2s;

import android.view.View;

import android.widget.TextView;

public class Main {
    public static boolean populateTextView(View root, int id, String message) {
        return populateTextView(root.findViewById(id), message);

    }// w  w w.  j a v  a 2s.c om

    public static boolean populateTextView(View view, String message) {
        if (view != null && view instanceof TextView) {
            return populateTextView((TextView) view, message);
        }
        return false;
    }

    public static boolean populateTextView(TextView textView, String message) {
        if (textView != null) {
            textView.setText(message);
            return true;
        }
        return false;
    }
}

Related Tutorials