Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;

import android.text.TextUtils;
import android.view.View;

import android.widget.TextView;

public class Main {

    public static void updateTitle(TextView view, String title) {
        if (view != null && !TextUtils.isEmpty(title)) {
            view.setVisibility(View.VISIBLE);
            view.setSelected(true);
            view.setText(title);
        }
    }

    public static void updateTitle(Activity activity, int viewId, String title) {
        TextView view = (TextView) activity.findViewById(viewId);
        updateTitle(view, title);
    }

    public static void updateTitle(Activity activity, int viewId, int resourceId) {
        TextView view = (TextView) activity.findViewById(viewId);
        String title = activity.getString(resourceId);
        updateTitle(view, title);
    }
}