Changeset 1745 for trunk/autoquest-androidmonitor/src/de/ugoe/cs
- Timestamp:
- 09/15/14 11:02:48 (10 years ago)
- Location:
- trunk/autoquest-androidmonitor/src/de/ugoe/cs/autoquest/androidmonitor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-androidmonitor/src/de/ugoe/cs/autoquest/androidmonitor/Androidmonitor.java
r1728 r1745 100 100 * 101 101 * @param view 102 * to be monitored 102 103 */ 103 104 public void addLogListenerToView(View view) { 105 addLogListenerToView(view, 0); 106 } 107 108 /** 109 * replace the listener of each view with a composite listener which 110 * collects several listeners for one view. 111 * 112 * @param view 113 * to be monitored 114 * @param parentHash 115 * hash of the parent view element 116 */ 117 private void addLogListenerToView(View view, int parentHash) { 118 119 logFile.addComponent(view, parentHash, activityName); 120 121 // hash code of the actual view element. Problem in using 122 // view.getParent().hashCode() is described in 123 // de.ugoe.cs.autoquest.androidmonitor addComponent() 124 parentHash = view.hashCode(); 104 125 // traverse all views of the activity 105 logFile.addComponent(view, activityName);106 126 if (view instanceof ViewGroup) { 107 127 ViewGroup group = (ViewGroup) view; 108 128 for (int i = 0; i < group.getChildCount(); i++) { 109 129 View child = group.getChildAt(i); 110 addLogListenerToView(child );130 addLogListenerToView(child, parentHash); 111 131 } 112 132 } -
trunk/autoquest-androidmonitor/src/de/ugoe/cs/autoquest/androidmonitor/AndroidmonitorLogFile.java
r1728 r1745 60 60 61 61 } else { 62 // tbdadd activity information62 // TODO add activity information 63 63 } 64 64 } catch (Exception e) { … … 133 133 } 134 134 135 public void addComponent(View view, String activityName) {135 public void addComponent(View view, int parentHash, String activityName) { 136 136 XmlSerializer serializer = Xml.newSerializer(); 137 137 StringWriter writer = new StringWriter(); … … 152 152 serializer.attribute("", "name", "path"); 153 153 serializer.attribute("", "value", activityName + "/" 154 + getViewPath(view) );154 + getViewPath(view) + view.getClass().getSimpleName()); 155 155 serializer.endTag("", "param"); 156 156 … … 162 162 serializer.startTag("", "param"); 163 163 serializer.attribute("", "name", "parent"); 164 // serializer.attribute("", "value", "" + 165 // view.getParent().hashCode()); 164 // Problem in using view.getParent().hashCode(): 165 // http://developer.android.com/reference/android/view/View.html#getParent() 166 // tells: "... parent is a ViewParent and not necessarily a View." 167 // ViewParent does not have a method hashCode(). Solution is done 168 // add parentHash as parameter to method addComponent() and 169 // Androidmonitor-> addLogListenerToView. 170 serializer.attribute("", "value", "" + parentHash); 166 171 serializer.endTag("", "param"); 167 172
Note: See TracChangeset
for help on using the changeset viewer.