get Application Using Reflection - Android App

Android examples for App:App Information

Description

get Application Using Reflection

Demo Code


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

public class Main {
    public static Application getApplicationUsingReflection()
            throws Exception {
        return (Application) Class.forName("android.app.ActivityThread")
                .getMethod("currentApplication")
                .invoke(null, (Object[]) null);
    }//w  w  w. j av  a2s . c om
}

Related Tutorials