0

Currently if i click Activity Manager State inside Android Studio, i will able to see such log:

TASK com.blogspot.diannaoxiaobai.myorig2 id=289
  ACTIVITY com.blogspot.diannaoxiaobai.myorig2/.MainActivity 3c65e06 pid=15238
    Local FragmentActivity 3076abe State:
      mCreated=truemResumed=true mStopped=false mReallyStopped=false
      mLoadersStarted=true
    FragmentManager misc state:
      mHost=android.support.v4.app.FragmentActivity$HostCallbacks@9a2871f
      mContainer=android.support.v4.app.FragmentActivity$HostCallbacks@9a2871f
      mCurState=5 mStateSaved=false mDestroyed=false
    View Hierarchy:
      com.android.internal.policy.PhoneWindow$DecorView{592a6c V.E..... ... 0,0-1080,1920}
        android.widget.LinearLayout{c6c2835 V.E..... ... 0,0-1080,1812}
          android.view.ViewStub{c4b74ca G.E..... ... 0,0-0,0 #102039f android:id/action_mode_bar_stub}
          android.widget.FrameLayout{7f2763b V.E..... ... 0,72-1080,1812}
            android.support.v7.widget.FitWindowsLinearLayout{ee48158 V.E..... ... 0,0-1080,1740 #7f0c0055 app:id/action_bar_root}
              android.support.v7.widget.ViewStubCompat{8c412b1 G.E..... ... 0,0-0,0 #7f0c0056 app:id/action_mode_bar_stub}
              android.support.v7.widget.ContentFrameLayout{f141396 V.E..... ... 0,0-1080,1740 #1020002 android:id/content}
                android.widget.RelativeLayout{5883b17 V.E..... ... 0,0-1080,1740}
                  android.support.v4.widget.NestedScrollView{7cc5b04 VFED.... ... 0,48-1032,1692}
                    android.widget.LinearLayout{ed628ed V.ED.... ... 0,90-942,8430}
                      android.widget.FrameLayout{5f5d322 V.E..... ... 0,0-942,900 #7f0c0087 app:id/nav_drawer}
                        android.widget.RelativeLayout{e4b71b3 V.E..... ... 0,0-942,900}
                          android.support.v7.widget.AppCompatImageView{6362370 V.ED.... ... 0,0-942,900}
...

I able to see which activity and fragment name from this log, but how about xml name ? Is there any debug tools/utilities to show activated/focusing/running Activity/Fragment/Adapater's xml filename (without manually insert Log.d() in each file) ? Like how kodi.log do. I can accept if root required.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
林果皞
  • 7,539
  • 3
  • 55
  • 70
  • You could create your own activity base class that logs the content view id, but I'm not sure you can get the name of the resource without some reflection – OneCricketeer Oct 05 '16 at 05:19
  • @cricket_007 I don't know why you've removed `android-studio` tag, even the `Activity Manager State` reside Android Studio. – 林果皞 Oct 05 '16 at 05:25
  • The question is about Android Development to display an XML resource loaded in the app, not the IDE itself – OneCricketeer Oct 05 '16 at 05:28
  • @cricket_007 If `Activity Manager State` which was trigger from IDE able to show this xml information after modify some magic bits, why not tag `Android Studio` IDE ? – 林果皞 Oct 05 '16 at 05:31
  • Because that would require you to modify the source code of the IDE that talks to the device? I doubt you want to do that. It's also not really clear why you care about such a feature unless you have many XML layouts. Besides, multiple layouts can be inflated into a single view. If you really want this, make a feature request to Android Studio – OneCricketeer Oct 05 '16 at 05:36
  • And, you mention Kodi, which is open source itself. Specifically, you can find how to get the source code here. http://kodi.wiki/view/Developing_Kodi_for_Android – OneCricketeer Oct 05 '16 at 05:40
  • @cricket_007 I mentioned kodi because i developed in kodi for 4 years and i know how convenient if i can see the activated xml log in android too. Ok, so the answer is no such tools exist and i need a feature request. – 林果皞 Oct 05 '16 at 05:53
  • 1
    I guess this would work, but as I said, you'll need a Base activity, Fragment, adapter, etc class that you extend that can log the value. http://stackoverflow.com/questions/10137692/how-to-get-resource-name-from-resource-id – OneCricketeer Oct 05 '16 at 05:58

0 Answers0