Index: trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor/AndroidMonitorLogFile.java
===================================================================
--- trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor/AndroidMonitorLogFile.java	(revision 1842)
+++ trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor/AndroidMonitorLogFile.java	(revision 1871)
@@ -90,9 +90,4 @@
      */
     public AndroidMonitorLogFile(Activity activity) {
-
-        AndroidMonitorLogFile.currentLoggedComponents = new ArrayList<Integer>();
-
-        AndroidMonitorLogFile.appName = getAppLable(activity);
-
         createFile(activity);
     }
@@ -111,5 +106,5 @@
 
     /**
-     * Get application name as defined in Package Name
+     * Get application name as defined in Package Name and write it to appName.
      * 
      * @param pContext
@@ -121,4 +116,5 @@
         // http://stackoverflow.com/questions/11229219/android-get-application-name-not-package-name
         // (last call 2014-09-04)
+        String appLabel;
         PackageManager lPackageManager = pContext.getPackageManager();
         ApplicationInfo lApplicationInfo = null;
@@ -127,7 +123,10 @@
                 lPackageManager.getApplicationInfo(pContext.getApplicationInfo().packageName, 0);
         }
-        catch (final NameNotFoundException e) {}
-        return (String) (lApplicationInfo != null ? lPackageManager
+        catch (final NameNotFoundException e) {
+            
+        }
+        appLabel = (String) (lApplicationInfo != null ? lPackageManager
             .getApplicationLabel(lApplicationInfo) : "Unknown");
+        return appLabel;
     }
 
@@ -269,15 +268,22 @@
             serializer.startTag("", "component");
             /*
-             * (non-Javadoc) TODO find a way in that the hash code is unique over time and target
+             * (non-Javadoc) 
+             * TODO find a way in that the hash code is unique over time and target
              * 
              * view.getId() seems to be unique over time and targets but there is a problem. In some
              * cases there is no ID (value: -1).
              * 
-             * view.getId() is not unique in every case. E.g. in the application timerdroid the id
-             * of the list elements changes when calling home button.
+             * view.getId() returns different values in case of some identical components. 
+             * E.g. in the application timerdroid the id of the list elements 
+             * changes when calling home button.
              */
             serializer.attribute("", "hash", "" + view.hashCode());
             currentLoggedComponents.add(view.hashCode());
 
+            /*
+             * (non-Javadoc)
+             * http://developer.android.com/reference/android/view/View.html#getId()
+             * Returns this view's identifier.
+             */
             serializer.startTag("", "param");
             serializer.attribute("", "name", "id");
@@ -296,6 +302,4 @@
                 serializer.startTag("", "param");
                 serializer.attribute("", "name", "title");
-               
-                
                 serializer.attribute("", "value", "image:" );
                 serializer.endTag("", "param");
@@ -316,5 +320,6 @@
             serializer.attribute("", "name", "parent");
             /*
-             * (non-Javadoc) Problem in using view.getParent().hashCode():
+             * (non-Javadoc) 
+             * Problem in using view.getParent().hashCode():
              * http://developer.android.com/reference/android/view/View.html#getParent() tells:
              * "... parent is a ViewParent and not necessarily a View." ViewParent does not have a
@@ -487,5 +492,6 @@
      */
     private void createFile(Activity activity) {
-
+        
+        AndroidMonitorLogFile.appName = getAppLable(activity);
         AndroidMonitorLogFile.name =
             "androidLogFile_" + AndroidMonitorLogFile.appName + System.currentTimeMillis() + ".log";
@@ -494,8 +500,10 @@
                 new File(activity.getFilesDir(), AndroidMonitorLogFile.name);
             if (AndroidMonitorLogFile.file.exists() && !AndroidMonitorLogFile.file.isDirectory()) {
-                createFile(activity, 0);
+                createFile(activity, 0);                
             }
             else {
+                AndroidMonitorLogFile.currentLoggedComponents = new ArrayList<Integer>();
                 writeHeaderToFile(activity);
+                
             }
         }
@@ -521,4 +529,5 @@
             "androidLogFile_" + count + "_" + AndroidMonitorLogFile.appName +
                 System.currentTimeMillis() + ".log";
+        
         try {
             AndroidMonitorLogFile.file =
