i have a problem with the gui in my android (smartphone) application.
At startup everything is fine, but after some time the GUI starts to get messed up. Some elements ore not drawn completely, sometimes im getting a full black screen in some of my tabs. And some animations do not work anymore.
I already tried to switch off hardware acceleration in application and activities, but that did not help at all.
The appearence of the bug is rather random, but i have the feeling that switching between background and foreground sometimes triggers it.
The application is rather dynamic. I have 4 tabs that are shown in a self programmed tab view, so everything is running in one activity. the content of the tabs also changes by user input or other triggers. This is done by loading predefined xml views and animations.
Anyone any ideas?
I now resolved the problem by refactoring the whole project and use the fragments api of android to generate my views instead of using my own solution.
I still have no clue why the rendering of views randomly failed or produced incomplete views without any log errors but perhaps this will help others with the same problems.
Related
I have an Activity, which has a Fragment, inside of which is a ViewPager of images. In the ViewPager, there might be certain images which are sensitive, and the viewer should not be able to take a screenshot of (only) those. When such an item shows, I do:
fragment.getActivty().getWindow().addFlags(FLAG_SECURE).
And then in that fragment's onDestroy (or ViewPager's swipe), I clear that flag on the window.
This works perfectly on Android versions 6.0 and above: when that particular image is open, screenshots are blocked.
However, on Android 5.x and below, the flag update does not take place till there's a configuration change on the hosting Activity.
Does anyone know why this happens? And what's the best workaround?
I found some references here on StackOverflow, talking about the problem and a workaround, but (a) nothing explains why there's this discrepancy and (b) the workaround suggested is very, very high friction: it flashes the entire screen black.
References:
How to disable screen capture in Android fragment?
I have incredibly hard problem to pinpoint.
I have a project which is not really important here (actually tested it on other project, same thing, and also on another computer, same thing) with typical hierarchy. Within it I use custom views, and also use custom views from my external library (which initially thought is the cause, but it isn't as the same thing happens with custom views within src of the same project). I use some of those custom views inside my xml's defining views. I had a need to debug some operations going on within one of those custom view classes. So I set couple breakpoints, ran the project, and when the runtime hit them I saw this screen:
As you see the debugging is broken although the breakpoint is hit on exact line I put it. I cannot do anything here though, except resuming it or terminating it. All the "step in/out" options are greyed out, and the stack trace for the main thread is literaly gone.
This happens on the Galaxy S4 (i9500) that I aquired lately. I cannot say for certain, but I'm pretty sure on my previous Galaxy S+ (i9001) it did not happen.
More information for you:
My i9500 is rooted with custom kernel flashed. The DDMS screen also does not show any processes that are going on on my device (was deffinetly showing on galaxy s+ I had before):
As you see, the processes are being shown just fine inside an emulator, but there are no processes (the application process for the project, after I run it is being shown there, but nothing else).
As for emulator, same machine (tested on both), same environment, same projects, and no problems with debugging it whatsoever:
As you see, everything is perfect over here.
Another important information is that it only happens (from what I see) when xml views are being processed. When I create a reference to one of my custom views manually, debugging works as expected on both the emulator, and the device. So far, it only happens when the breakpoint is being hit when the xml view is being processed.
The last piece of information is that my Device Chooser when I deploy application, shows empty space inside the Debug column. I don't know if it's relevant or not.
I've lost almost 5 hours now looking for solution of this problem (and the cause) on the web, without any luck.
From all the circumstances, it seems the problem is with galaxy s4 I have, not with the computer, or the IDE, or the project itself, but the question is, what is the problem. Tried reinstalling samsung drivers, tried uninstalling those and installing PDA.net drivers alone. No help.
If anybody of you will be able to figure out this puzzle, you are God. Besides that, you will have my deepest gratitude, as this issue is driving me nuts.
ps. I have all the android SDK's up to date, and eclipse plugin as well.
Half the answer (so far).
Upon updating to new 4.3 update, and new custom kernel (Perseus Kernel alfa 14), the DEBUG flag is shown in the Device Chooser dialog screen, and is set to YES. Also, the processes are now visible in DDMS.
Unfortunetly, still the stack is empty once the breakpoints are hit in the custom views.
A very strange problem that cause the app to draw ontop of itself without cleaning the previous frame.
Its a bit hard to explain, see the next image:
Some other symptoms of this problem:
If I start it on emulator with GPU, the problem occur.
However if I start the emulator without GPU, it does not.
The actual device that I use is connected to a monitor using HDMI. Maybe it is related.
Any help will be highly appreciated.
This looks like a very similar problem I've posted before (link here) .
The problem is that I tried to use 2 tricks for optimization - have an empty background for both the window and its views.
The reason is that there is the window of the activity already has a default background, but when you remove it, and the views don't have a background, Android doesn't "clear" the content with the background, so it smears...
Do note that this "bug" might occur on some devices yet on others it would work fine.
In short, the solution is to set a background to either the window or its views.
I'm building an html5 wrapped iOS / Android app with Trigger.io.
I have a problem on Android with a grey background appearing on the screen in some occasions after the virtual keyboard has closed, or after the phone has changed orientation.
Example screenshots are shown below.
The grey background is after the end of my app's page. Sometimes it is visible for a split second, other times it stays visible until you make an action such as scroll the page, bring the keyboard back, change orientation.
It's pretty jarring to look at.
I'd ideally like to stop the issue occurring, but as a temporary fix I'd be happy with being able to set the grey to my own background colour to make it less noticeable.
This looks like the HTML's not being re-drawn when the keyboard disappears... does it clear up if you do something to trigger a render?
Are you using a framework to handle the UI here? Something that might be trying to do something clever based on the visible viewport?
From what I can tell, the root of the issue is in the webview not re-drawing correctly, or something in your JavaScript failing to respond to the viewport changing size.
You could try running the app on the "web" target (instead of Android) then opening it in your phone's browser: if you can get far enough into the app to create the same effect it would help isolate the problem to the webview rendering or your JS.
I had a very similar issue in my project, in my case on Android 2.3.5 but not on Android 4.*. The cause in my case was not setting a window soft input mode for the associated activity in the manifest:
android:windowSoftInputMode="adjustPan"
Instead, the window was resizing when the keyboard appeared but apparently not resizing once more when the keyboard disappeared.
More details can be found here.
I almost went crazy with the same issue. I finally found out that this largely depends on the device you are using. I had a similar problem : Fixed elements (HTML) break after android keyboard dissapears?
And I am also using trigger.io. This doesn't happen with some devices. Could be the particular OS in android or could just be the way the specific device handles the memory latency.
I have looked for this but I go with #jamesbrady in that the HTML doesn't redraw. The problem in trigger is that you cannot edit the
android:windowSoftInputMode="adjustPan"
because the activity tag in the AndroidManifest.xml updates on each run. You would need to build a private module for that.
I am trying to develop an android application. I've put a scroll view as main container using graphical layout in eclipse. After that, I had put some UI elements, like buttons. When the total height of elements become more than viewable area, it can be seen using scroll view as expected. There is no problem until this point. The problem is the elements that are not fit viewable are of the screen can not be seen using graphical container of the eclipse interface. There is no problem with the source code, as it runs expectedly. Is there any option in the Eclipse gui to see the UI elements that are not fit the viewport?
I know what you're talking about. When you're viewing the xml file on the Eclipse Graphical layout you can only see the elements that fit on the screen. You can't scroll down to see the entire UI.
I use Eclipse at home and work. I'm using Eclipse Helios Service Release 1, on both systems. For some reason at home, when I'm on the graphical layout, there's a button on the upper right of the graphical viewer that says something like 'Remove Clipping'. (I'm at work now. So can't look to see exactly what it says).
When I click that button, I can now scroll down to see the entire UI. However, on my copy of Eclipse at work that same button isn't displayed. I've tried to figure out what the difference is between the setup on the two copies of Eclipse. But so far haven't been able to figure it out. Note, I've tried viewing the same exact xml file, within the same project, on both copies of Eclipse.
The problem seems to only occur when you're using a scrollview and all the ui elements won't fit on the graphical layout screen within Eclipse.
I have the same problem. I've been unable to troubleshoot, so I've resorted to using my physical device instead. I try to get the bulk of work done within the the Eclipse GUI... then nudge and polish with my device. Its a PITA to be sure, uploading what seems like a million times only to move one element a tiny bit more.
Best practices recommend developing on a device. Further, the Layout-tools && scrollView basically make it mandatory to really know what is going on. I can't seem to form this into a coherent search argument as my Google-fu has let me down on this one.
BTW - I'm using the shiny new r10 ADT plugin and I've been struggling with this for about 6 months.
Another workaround: You can use a smaller-ish tablet port in the GUI to get a really rough idea of what you are working with.
If your target layout is for a phone or smaller device, simply switch the preview to a larger screen size configuration.
In the upper left corner, under where it says 'Editing config: ~default', The list provides you with a number of screen sizes to target. Pick the 10.1 in version, and it will scale the preview, and will then allow you to see and work with all of the views that have scrolled off the screen.
Cheers-
I think this is an old topic but I was having the same issue. I have 2 apps made from outsourcing. when I opened each in eclipse one would show the full contents of the scrollview and one was clipped off. After numerous google searches nothing came up as a solution. I just happen to look and saw the app that is clipped was android version 1.6 and the app that shows everything like i wanted it to so I can use the graphical layout for a scrollview was android verion 2.1.
So i changed the one app to version 2.1 and it fixed it. noone seemed to address that. so for me the fix was make sure the android version you are building for is 2.1. you can always change it back to 1.6 compatable after you are done designing.
Hope this helps
The best way i could figure out is to give negetive top margin to the root layout that will make the rest of the content visible. This is only for dev purpose and should be removed when completed