android: how to debug UI - android

I am new to android technology, while developing application i need to debug the UI component like why this textview is not displayed or so.
Like we have Log facility for the java code, do we have similar kind of thing for xml also.
so that we can verify which layout is overlapping with another or find out other distortion in UI
Thanks for your time.

In Eclipse, there is a helpful tool to see your UI hierarchy. When in debug mode, open the "Devices" window (if you can't find it: Alt+Shift+Q, Q). Then click the "Dump View Hierarchy for UI Automator".
You can see some view attributes there as well as the way it's build up.
There's also a hierarchy viewer in the SDK tools/ directory, but I haven't used it yet.

It does have one. A very basic one. The problem is, the 'debugger' doesn't know what you want. Your TextView doesn't display is a problem for you because you want it to display. But the debugger though you left the code like this simply because you will programmatically add the text during run time. So debugger for UI wouldn't solve these kind of problems , but it will give you tips and warnings like this :

Related

Android: Debug which UI element under touch, focus etc

I have very complex layout xml (1K+ code rows). When I perform under testing some input (touch, click, swipe...) I want to know what happens: Which elements under focus, which elements got click events etc.
I tried under developer options to enable show layout bounds & show touches. But it's not what I'm looking for. Also I want to avoid solution of Log prints on entry to View methods, Because I think must be a more direct method.
EDIT - This app dev environment is still Eclipse.
Thanks,
Try the Hierarchy Viewer of the Android Studio Tools. It work fine for your purpose.
If you are using the Android SDK in any other way, you can see here that you can find the same Hierarchy Viewer from the SDK tools/ directory, entering to monitor.

Android Background is showing in the graphical layout but not on the device

I cannot see what the issue is. I am using eclipse 4.2.2. My SDK is fully updated.
When I set an application background in Android, it shows up on the graphical layout but not on the device. I have made a few apps that do nothing but display images or text on a single activity. Some of them will display the background using the same image that others wont. But in all cases it shows up in the graphical layout.
What are some common causes for this?
I am very much a beginner.
Thank you VERY much for the help.
I guess this is a very common problem.update your manifest file.Check whether you have used
try build the project using that sdk version and open up the avd using that particular api.All images will be shown.

Android editor Using Eclipse Link XML views to edit code and view graphic?

hi I'm using Eclipse at the moment, and I'm not sure if there is a plug in for it or a better piece of software I can use. It seems fine for the Java side The problem I have is with XML editing, the line up of the characters is very inconsistent and when editing my layouts, I work with a graphic view open and a code view open, but the two are not linked, so if I double click on an element it switches from graphic view to code view in that pane. it would be awesome if I could link the two open panes?
Please see the screen shot for my desired outcome.
I understand that this question could be seen as discussion based, but I am seriously just looking for a solution here. The example I show is very simple, but some of the xml files turn out quite large and complex, and it is becoming more important to me to find a solution for this.
You can use DroidDraw for ui designing. Although it is a bit buggy, but at-least you dont need to edit raw xml files if you use this.
I am now using the Android eclipse Juno development kit, and while I still dont have dual window available, the double click select is working. there is also an Outline pane which shows the layout, although annoyingly this doesn't show comments very well.

Demoing android app screenshots

I need a way to show off concept designs of an android application on an android phone to simulate that it is running. Basically just being able to tap to advance to the next photo/screen would be sufficient with a tap ANYWHERE on the screen. Any tools you know that would be helpful?
Eclipse with Android toolkit.
Write a small program. wont take up much time.
[update]
No coding is required. Create an android project Using Eclipse android project, you can visually create UI prototype (i.e. drag and drop .. no coding). Use main.xml after developing each screen run the project in emulator, you can take screenshot of the same (either using eclipse DDMS plugin's snapshot capability or using Alt+Print screen in windows or something similar in other OS). Use this screenshot in a powerpoint presetation . Repeat the same process for a second screen (overwrite the same main.xml so that you dont have to write code). take screenshot again. Add the required animations in powerpoint.
Is there any other option that does not involve any code?
The easiest way I can think of is:
1. Take screen shots(wireframes, screen prototypes) for every screen flow you wish to demonstrate.
2. add them in proper sequence(regulated by sequence number) to your sdcard.
3. Open Picture gallery and use swipe gesture to transition and cycle between screen, walk through all the screen flows.
Do it photoshop, create images, add it to an activity. Create a layout that fills the parent, add it as a background. Then implement a ontouch method to finish the activity and load the next. Quite simple.

"uiautomator dump" does not show custom launcher or applications in dump xml

Good day,
I have a custom android launcher I would like to test using adb. This launcher is effectively an android "Service" (android.app.Service) that renders a shape. Rendered within this shape are the available applications, rendered with their names and icons. Pretty standard. This all shows up just fine on my android virtual device (avd)
The problem is there is no mention of any of the outer launcher shape or any of its Image view apps in the uiautomator dump xml. If I am to test my UI I need to be able to assert against the current state of the UI which means getting this data somehow.
Does anyone know how to get the uiautomator dump command to represent everything on the screen in its xml output? Am I missing some programmatic registration step when creating my ImageViews and TextViews? Do I need to somehow register my overall layout?
Thanks for taking the time to read, any help would be most appreciated.
Solution!
When dropping UI elements directly into the window manager (that is, android.view.WindowManager) outside of any android activity, make sure that when allocating your WindowManager handle instance, i.e. new WindowManager.LayoutParams(...) that the flag "WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE" is absent.

Categories

Resources