get Application Using Reflection - Android android.content.pm

Android examples for android.content.pm:App

Description

get Application Using Reflection

Demo Code

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);
  }/*from   w  w  w .j a va  2s. c  o m*/

}

Related Tutorials