Example usage for android.app Activity toString

List of usage examples for android.app Activity toString

Introduction

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

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:Main.java

/**
 * Call this method on the Activity onDestroy.
 * @param activity/*w w  w .  j  av a2 s  .  c om*/
 */
public static void onDestroy(Activity activity) {
    localesOnActivities.remove(activity.toString());
}

From source file:Main.java

/**
 * Call this method on the Activity onResume. It will recreate the Activity if a Locale change is detected.
 * @param activity//from   w  w  w.  ja va2 s  .  c  o m
 */
public static void onResume(Activity activity) {
    Locale previousLocale = localesOnActivities.get(activity.toString());
    boolean shouldRestartActivity = previousLocale != null && !previousLocale.equals(Locale.getDefault());

    localesOnActivities.put(activity.toString(), Locale.getDefault());

    if (shouldRestartActivity) {
        recreate(activity, false);
    }
}

From source file:org.fennd.note.simple.view.DeleteNoteDialog.java

public static DeleteNoteDialog newInstance(Activity activity) {
    // Verify that the host activity implements the callback interface
    try {//from   w ww  .ja va2s .  c o  m
        // Instantiate the NoticeDialogListener so we can send events with
        // it.
        mListener = (DeleteDialogListener) activity;
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception.
        throw new ClassCastException(activity.toString() + " must implement NoticeDialogListener");
    }
    DeleteNoteDialog frag = new DeleteNoteDialog();
    return frag;
}

From source file:org.fennd.note.simple.view.NewNoteDialog.java

public static NewNoteDialog newInstance(Activity activity) {
    // Verify that the host activity implements the callback interface
    try {//from  ww  w . j a  va  2 s  . c  o  m
        // Instantiate the NoticeDialogListener so we can send events with
        // it.
        mListener = (NewNoteDialogListener) activity;
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception.
        throw new ClassCastException(activity.toString() + " must implement NoticeDialogListener");
    }
    NewNoteDialog frag = new NewNoteDialog();
    return frag;
}

From source file:com.remotedroid.app.ComputerOptionsDialog.java

/**
 * Creates a new instance with a computer item embedded.
 * //ww  w. j  a  v  a  2s.c o m
 * @param item
 *            the item
 * @return the dialog fragment
 */
public static ComputerOptionsDialog newInstance(Activity act, Computer item) {
    if (item == null)
        throw new NullPointerException("Computer cannot be null");

    ComputerOptionsDialog dialog = new ComputerOptionsDialog();
    dialog.computer = item;

    try {
        mListener = (ComputerOptionClickedListener) act;
    } catch (ClassCastException e) {
        throw new ClassCastException(act.toString() + " must implement ComputerOptionClickedListener");
    }

    return dialog;
}

From source file:org.iisgcp.waterwalk.utils.HelpDialog.java

public static HelpDialog newInstance(Activity activity, String dialogTitle, String dialogText) {
    // Verify that the host activity implements the callback interface
    try {//  ww  w  . ja  va2s  . co m
        // Instantiate the HelpDialogListener so we can send events with it
        mListener = (HelpDialogListener) activity;
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception
        throw new ClassCastException(activity.toString() + " must implement HelpDialogListener");
    }

    HelpDialog frag = new HelpDialog();

    // Supply dialog text as an argument.
    Bundle args = new Bundle();
    args.putString("dialog_title", dialogTitle);
    args.putString("dialog_text", dialogText);
    frag.setArguments(args);

    return frag;
}

From source file:net.sourceforge.servestream.utils.LoadingDialog.java

public static LoadingDialog newInstance(Activity activity, String dialogText) {
    // Verify that the host activity implements the callback interface
    try {//from w w  w  . ja  v a 2  s . co  m
        // Instantiate the LoadingDialogListener so we can send events with it
        mListener = (LoadingDialogListener) activity;
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception
        throw new ClassCastException(activity.toString() + " must implement LoadingDialogListener");
    }
    LoadingDialog frag = new LoadingDialog();

    // Supply dialog text as an argument.
    Bundle args = new Bundle();
    args.putString("dialog_text", dialogText);
    frag.setArguments(args);

    return frag;
}

From source file:net.sourceforge.servestream.utils.SleepTimerDialog.java

public static SleepTimerDialog newInstance(Activity activity, int sleepTimerMode) {
    // Verify that the host activity implements the callback interface
    try {/*from  ww w  .ja  va 2 s.c o  m*/
        // Instantiate the SleepTimerDialogListener so we can send events with it
        mListener = (SleepTimerDialogListener) activity;
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception
        throw new ClassCastException(activity.toString() + " must implement SleepTimerDialogListener");
    }
    SleepTimerDialog frag = new SleepTimerDialog();

    // Supply dialog text as an argument.
    Bundle args = new Bundle();
    args.putInt("sleep_timer_mode", sleepTimerMode);
    frag.setArguments(args);

    return frag;
}

From source file:com.piusvelte.cloudset.android.ConfirmDialog.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (!(activity instanceof DevicesListener)) {
        throw new ClassCastException(activity.toString() + " must implement ConfirmDialogListener");
    }/*  w  w  w  . ja va 2 s.  co  m*/
}

From source file:com.digi.android.wva.fragments.ConnectionErrorDialog.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (!(activity instanceof ErrorDialogListener)) {
        throw new ClassCastException(activity.toString() + " must implement ErrorDialogListener!");
    }//from w w  w. ja  v  a  2 s  .c om
}