ratulalahy
ratulalahy

Reputation: 480

Using Hierarchy Viewer for Android App Widget

Is it possible to use Hierarchy Viewer for App Widget? If yes, how? and is there any Tutorial for that?

Upvotes: 3

Views: 2139

Answers (3)

PrimankaDEN
PrimankaDEN

Reputation: 41

Now Hierarchy Viewer is deprecated, you should use Layout Inspector. I follow next steps:

  1. launch my app with widget on emulator
  2. click Tools/Layout Inspector
  3. Set check box Show all processes
  4. Next you should choose the process. Android app widget code executes in OS launcher process, so you need choose it in Choose Process menu. For me it calls com.android.launcher3
  5. After all you get layout with your app widget

I think this steps don't work with real device, because system process doesn't available for debugging

Upvotes: 1

neteinstein
neteinstein

Reputation: 17613

This was the correct answer until Romain Guy developed a workaround.

You can now add the ViewServer class to your project, and use HierarchyView in any device.

The code needed is available here: https://github.com/romainguy/ViewServer

For more info check this .

Upvotes: 0

Egis
Egis

Reputation: 879

Have you tried using Hierarchy Viewer for UI elemements? I followed these instructions yesterday and they worked fine for me.

To run Hierarchy Viewer, you can follow these steps:

  1. Connect your device or launch an emulator.
    To preserve security, Hierarchy Viewer can only connect to devices running a developer version of the Android system.
  2. If you have not done so already, install the application you want to work with.
  3. Run the application, and ensure that its UI is visible.
  4. From a terminal (command prompt), launch hierarchyviewer from the /tools/ directory.
  5. The first window you see displays a list of devices and emulators. To expand the list of Activity objects for a device or emulator, click the arrow on the left. This displays a list of the Activity objects whose UI is currently visible on the device or emulator. The objects are listed by their Android component name. The list includes both your application Activity and system Activity objects. A screenshot of this window appears in figure 1.
  6. Select the name of your Activity from the list. You can now look at its view hierarchy using the View Hierarchy window, or look at a magnified image of the UI using the Pixel Perfect window.

Since this will not work on a stock Android system you must use either a developer version or an emulator.

Please! check here

Please let me know if these instructions don't work for app widgets or if you have more questions.

Upvotes: 2

Related Questions