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:org.dmfs.android.retentionmagic.RetentionMagic.java

/**
 * Store all retainable fields of an Activity in a {@link Bundle}.
 * //from   www  . j  av a 2 s.  c o  m
 * @param activity
 *            The {@link Activity}.
 * @param instanceState
 *            The {@link Bundle} to store the state in.
 */
public static void store(final Activity activity, final Bundle instanceState) {
    try {
        storeAndRestore(activity.getClass(), activity, instanceState, true /* store */);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:org.dmfs.android.retentionmagic.RetentionMagic.java

/**
 * Restore all retainable fields of an Activity from a {@link Bundle}.
 * /*w  w  w . j  av  a 2 s.  c o m*/
 * @param activity
 *            The {@link Activity}.
 * @param instanceState
 *            The {@link Bundle} to store the state in.
 */
public static void restore(final Activity activity, final Bundle instanceState) {
    try {
        storeAndRestore(activity.getClass(), activity, instanceState, false /* restore */);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:org.dmfs.android.retentionmagic.RetentionMagic.java

public static void persist(final Activity activity, final SharedPreferences.Editor editor) {
    try {//from   w  w w .ja  va 2 s  . c o  m
        persist(activity.getClass(), activity, editor);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:samson.AndroidNotifications.java

/**
 * Constructs a new AndroidNotifications with the main activity to be launched when a
 * notification is tapped.//from w w w  .  j  a  v  a  2  s .c  o m
 */
public AndroidNotifications(Activity mainActivity) {
    this.activityClass = mainActivity.getClass();
    this.applicationContext = mainActivity.getApplicationContext();
    this.notificationManager = (NotificationManager) applicationContext
            .getSystemService(Context.NOTIFICATION_SERVICE);
    this.alarmManager = (AlarmManager) applicationContext.getSystemService(Context.ALARM_SERVICE);
}

From source file:uk.org.rivernile.edinburghbustracker.android.fragments.dialogs.DeleteAllAlertsDialogFragment.java

/**
 * {@inheritDoc}//from   w w  w  .java  2 s. c o  m
 */
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    try {
        callbacks = (Callbacks) activity;
    } catch (ClassCastException e) {
        throw new IllegalStateException(
                activity.getClass().getName() + " does not implement " + Callbacks.class.getName());
    }
}

From source file:com.morlunk.mumbleclient.channel.comment.AbstractCommentFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    try {// w  w  w.j av  a  2s .c o  m
        mProvider = (JumbleServiceProvider) activity;
    } catch (ClassCastException e) {
        throw new RuntimeException(activity.getClass().getName() + " must implement JumbleServiceProvider!");
    }
}

From source file:uk.ac.ucl.excites.sapelli.collector.fragments.ProjectManagerFragment.java

@Override
public void onAttach(Activity activity) {
    // make sure there is no cast exception:
    this.activity = ProjectManagerActivity.class.isAssignableFrom(activity.getClass())
            ? (ProjectManagerActivity) activity
            : null;/*from  www.  j a v a  2s.  c  o  m*/

    super.onAttach(activity);

    onOwnerAttached(this.activity);
}

From source file:es.usc.citius.servando.calendula.fragments.RoutineCreateOrEditFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    Log.d(getTag(),//from   w ww.j  a v a  2s  . c o m
            "Activity " + activity.getClass().getName() + ", " + (activity instanceof OnRoutineEditListener));
    // If the container activity has implemented
    // the callback interface, set it as listener
    if (activity instanceof OnRoutineEditListener) {
        Log.d(getTag(), "Set onRoutineEditListener onAttach");
        mRoutineEditCallback = (OnRoutineEditListener) activity;
    }
}

From source file:com.audiokernel.euphonyrmt.fragments.NowPlayingSmallFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    if (!MainMenuActivity.class.equals(activity.getClass())) {
        mForceStatusUpdate = true;//from   w w w.  ja v a2s  . co  m
    }
}

From source file:com.wkovacs64.nipthetip.ui.dialog.InputDialog.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {/* w  ww.j  av a2  s.  c  o  m*/
        mCallback = (Callback) activity;
    } catch (ClassCastException e) {
        Timber.e(e, activity.getClass().getSimpleName() + " must implement " + TAG + ".Callback!");
    }
}