Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.res.Resources;
import android.view.View;

public class Main {
    public static String getIDNameFromView(View v) {
        // -- get your View --
        int id = v.getId(); // get integer id of view
        String idString = "";
        if (id != View.NO_ID) { // make sure id is valid
            Resources res = v.getResources(); // get resources
            if (res != null)
                idString = res.getResourceEntryName(id); // get id string entry
        }
        return idString;
    }
}