Example usage for android.app Activity getClass

List of usage examples for android.app Activity getClass

Introduction

In this page you can find the example usage for android.app Activity getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:Main.java

public static void finishAllNoMainActivity() {
    for (Activity activity : allA) {
        if (!activity.getClass().getSimpleName().equals("Activity_Main")) {
            activity.finish();//from   ww  w.  j a  va2 s. com
        }
    }
}

From source file:Main.java

public static boolean isActivityExist(Class<?> cls) {
    for (Activity activity : stack) {
        if (activity.getClass().equals(cls)) {
            return true;
        }// w w w  . j  a v a2  s  .  c  o  m
    }
    return false;
}

From source file:Main.java

public static Activity getActivity(Class<?> cls) {
    if (activityStack != null)
        for (Activity activity : activityStack) {
            if (activity.getClass().equals(cls)) {
                return activity;
            }/*from   w  ww.j a v  a  2 s.  c  o m*/
        }
    return null;
}

From source file:Main.java

public static void saveCurrActivity(Activity activity) {
    saveActivity(activity, activity.getClass());
}

From source file:Main.java

public static Activity getActivity(Class<?> activityClass) {
    if (statckActivity != null) {
        for (Activity activity : statckActivity) {
            if (activity.getClass().equals(activityClass)) {
                return activity;
            }//from   www .j  a va  2 s .c om
        }
    }
    return null;
}

From source file:Main.java

private static boolean checkIfActivityImplementsInterface(Activity theActivity, Class theInterface) {
    for (Class i : theActivity.getClass().getInterfaces())
        if (i.toString().equals(theInterface.toString()))
            return true;
    return false;
}

From source file:Main.java

public static Activity getActivity(String className) {
    for (Activity activity : activityLists) {
        if (activity != null && activity.getClass().getSimpleName().equals(className))
            return activity;
    }/* www  .j  a  v a2 s  .c  om*/
    return null;
}

From source file:Main.java

public static void refreshActivity(Activity activity) {
    activity.finish();
    startActivity(activity, activity.getClass());
}

From source file:Main.java

public static void finishActivity(Class<?> cls) {
    try {//from w  w w. ja va 2  s . c o  m
        for (Activity activity : activityStack) {
            if (activity.getClass().equals(cls)) {
                finishActivity(activity);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static Object activityGetActionBar(Activity a) {
    try {/*  ww w .  j  a  v  a 2s  .  c  o m*/
        Method getActionBar = a.getClass().getMethod("getActionBar");
        return getActionBar.invoke(a);
    } catch (NoSuchMethodException ignore) {
    } catch (InvocationTargetException ignore) {
    } catch (IllegalAccessException ignore) {
    }

    return null;
}