title: How to get view ID using Accessibility Service in android
body: <p>I am a beginner to android. I want to get view id of the view, user is currently looking at. 
  I make my question a bit more clear.Suppose user opens MakeMyTrip and navigates upto Flight booking page.Now i want to get the View id of that particular layout.
  Below is my service class and xml configuration file.</p>
  
  <pre><code>public class MyAccessibilityService extends AccessibilityService {
  @Override
  public void onAccessibilityEvent(AccessibilityEvent event) {
  
      AccessibilityNodeInfo source = event.getSource();
  
      Log.d("ViewID",source.getViewIdResourceName());
  
  
  }
  
  @Override
  public void onInterrupt() {
  
  }
  
  
  
  &lt;accessibility-service
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:accessibilityEventTypes="typeWindowContentChanged"
  android:accessibilityFeedbackType="feedbackGeneric"
  android:accessibilityFlags="flagReportViewIds"
  android:canRetrieveWindowContent="true"
  android:description="@string/accessibility_service_description"
  android:packageNames="com.makemytrip" /&gt;
  </code></pre>