Index: trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor/AndroidMonitor.java
===================================================================
--- trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor/AndroidMonitor.java	(revision 1842)
+++ trunk/autoquest-androidmonitor/src/main/java/de/ugoe/cs/autoquest/androidmonitor/AndroidMonitor.java	(revision 1871)
@@ -62,5 +62,4 @@
         return monitor;
     }
-   
 
     /**
@@ -70,28 +69,30 @@
      */
     public void startMonitor(Activity activity) {
-        //create logFile only once
-        if(AndroidMonitor.logFile == null){
+        // create logFile only once.
+        if (AndroidMonitor.logFile == null) {
             AndroidMonitor.logFile = new AndroidMonitorLogFile(activity);
             Log.i("logfile", "file created");
         }
-        activityName = activity.getClass().getSimpleName();  
+        activityName = activity.getClass().getSimpleName();
         addLogListenerToView(getRootView(activity));
-        
-
-        // TODO
-        // listen to changes and update own listener
-
-        // write backPresss as event to xml file
-        // activity.onBackPressed();
-
-        // handle onStop() method of the activity
-        // add a function that end up tracking if onStop() is given otherwise
-        // create onStop()
-        // http://developer.android.com/training/basics/activity-lifecycle/stopping.html
-    }
-    public void startMonitor(View view){
+
+        /*
+         * TODO listen to changes and update own listener. - Listen to known elements is implemented
+         * and trigger startMonitot(View).
+         */
+        /*
+         * TODO write backPresss as event to xml file activity.onBackPressed();
+         */
+        /*
+         * TODO handle onStop() method of the activity add a function that end up tracking if
+         * onStop() is given otherwise. Maybe: create onStop()
+         * http://developer.android.com/training/basics/activity-lifecycle/stopping.html
+         */
+    }
+
+    public void startMonitor(View view) {
         addLogListenerToView(findFirstView(view));
     }
-    
+
     /**
      * Get the root view of an activity.
@@ -149,4 +150,6 @@
         if (!AndroidMonitorLogFile.isComponentLogged(view.hashCode())) {
             AndroidMonitor.logFile.addComponent(view, parentHash, activityName);
+
+            Log.i("object type", "");
 
             // save original listener to add it later on to the groupLisatener
@@ -215,6 +218,6 @@
      * @return the listener of the view or null if no listener exists
      */
+    // source: http://stackoverflow.com/questions/11186960/getonclicklistener-in-android-views
     private View.OnClickListener getOnClickListener(View view) {
-        // http://stackoverflow.com/questions/11186960/getonclicklistener-in-android-views
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
             return getOnClickListenerV14(view);
@@ -226,4 +229,5 @@
 
     // Used for APIs lower than ICS (API 14)
+    // source: http://stackoverflow.com/questions/11186960/getonclicklistener-in-android-views
     private View.OnClickListener getOnClickListenerV(View view) {
         View.OnClickListener retrievedListener = null;
@@ -250,4 +254,5 @@
     // Used for new ListenerInfo class structure used beginning with API 14
     // (ICS)
+    // source: http://stackoverflow.com/questions/11186960/getonclicklistener-in-android-views
     private View.OnClickListener getOnClickListenerV14(View view) {
         View.OnClickListener retrievedListener = null;
@@ -283,6 +288,4 @@
     }
 
-    
-    
     /**
      * 
@@ -290,10 +293,9 @@
      * Return the AndroidMonitorLogFile that is used in the AndroidMonitor.
      * </p>
-     *
-     * @return AndroidMonitorLogFile 
-     *          that is used in the AndroidMonitor.
-     */
-    public AndroidMonitorLogFile getLogFile(){
-        return logFile;        
+     * 
+     * @return AndroidMonitorLogFile that is used in the AndroidMonitor.
+     */
+    public AndroidMonitorLogFile getLogFile() {
+        return logFile;
     }
 }
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 =
