get Class by class name - Android java.lang.reflect

Android examples for java.lang.reflect:Class

Description

get Class by class name

Demo Code


//package com.java2s;

import android.util.Log;

public class Main {
    private static final String TAG = "loader";

    public static Class getClass(String name) {
        try {/*  w w  w.j ava  2s  .  c  om*/
            return Class.forName(name);
        } catch (ClassNotFoundException e) {

            Log.e(TAG, e.getMessage(), e);
            return null;
        }
    }
}

Related Tutorials