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.view.View;

import android.widget.TextView;

public class Main {

    public static void updateLeftTitle(Activity activity, int viewId, int resource) {
        View view = activity.findViewById(viewId);
        if (view == null) {
            return;
        }
        if (view instanceof TextView) {
            ((TextView) view).setText(activity.getString(resource));
        }
    }

    public static void updateLeftTitle(Activity activity, int viewId, String text) {
        View view = activity.findViewById(viewId);
        if (view == null) {
            return;
        }
        if (view instanceof TextView) {
            ((TextView) view).setText(text);
        }
    }

    public static void updateLeftTitle(View view, int viewId, String text) {
        View subView = view.findViewById(viewId);
        if (subView == null) {
            return;
        }
        if (subView instanceof TextView) {
            ((TextView) subView).setText(text);
        }
    }
}