Android Open Source - Archeology Utils






From Project

Back to project page Archeology.

License

The source code is released under:

GNU General Public License

If you think the Android project Archeology listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Chipotle Software (c) GPLv3 2013 //from w  w w.  ja va 2 s.co m
 */

package com.chipotle.archeology.util;

import android.os.Handler;
import android.widget.TextView;

import java.util.List;

public class Utils {

  private static StatusTracker mStatusTracker = StatusTracker.getInstance();

  /**
   * Helper method to print out the lifecycle state of each Activity.  Note this has
   * been wrapped in a Handler to delay the output due to overlaps in lifecycle state
   * changes as one Activity launches another.
   * @link http://developer.android.com/guide/topics/fundamentals/activities.html#CoordinatingActivities
   * @param viewMethods TextView to list out the lifecycle methods called
   * @param viewStatus TextView to list out the status of all Activity classes
   */
  public static void printStatus(final TextView viewMethods, final TextView viewStatus) {

      Handler handler = new Handler();

      handler.postDelayed(new Runnable() 
      {
          public void run() {
              // Get the stack of Activity lifecycle methods called and print to TextView
              StringBuilder sbMethods = new StringBuilder();
              List<String> listMethods = mStatusTracker.getMethodList();
              for (String method : listMethods) {
                  sbMethods.insert(0, method + "\r\n");
              }
              if (viewMethods != null) {
                  viewMethods.setText(sbMethods.toString());
              }

              // Get the status of all Activity classes and print to TextView
              StringBuilder sbStatus = new StringBuilder();
              for (String key : mStatusTracker.keySet()) {
                  sbStatus.insert(0,key + ": " + mStatusTracker.getStatus(key) + "\n");
              }
              if (viewStatus != null) {
                  viewStatus.setText(sbStatus.toString());
              }
        }
      }, 750);
    }
}




Java Source Code List

com.chipotle.archeology.ActivityB.java
com.chipotle.archeology.ActivityC.java
com.chipotle.archeology.DialogActivity.java
com.chipotle.archeology.DisplayMessageActivity.java
com.chipotle.archeology.MainActivity.java
com.chipotle.archeology.util.StatusTracker.java
com.chipotle.archeology.util.Utils.java