Can you draw over Facebook chat heads on Android? - android

I have an app that draws an overlay. However, the Facebook chat heads are always drawn over the top of my overlay. I have tried re-drawing my overlay every second (obviously I wouldn't do this in the final app) but the chat head just stays on top, there isn't even any flicker giving a clue that it's being re-drawn. I would expect the last overlay drawn to win and end up on top so unless Facebook is redrawing at a ridiculous rate what are they doing? Any ideas? Thanks.

I fixed it by setting the type in the layout params to TYPE_APPLICATION_OVERLAY for Oreo and later and to TYPE_SYSTEM_ALERT for pre-Oreo.

Related

Android making scale (ruler) on screen

In my application I want to create a ruler to measure length. I have gone through some ruler application in google store. I want to achieve somewhat as shown in the picture.
So my question is how do I draw this marking as per users mobile screen configuration. Is it using using some drawable image or some drawing on canvas.
I am new to android development. Also that the ruler when dragged downward marking and numbering move. So how to achieve that thing.
These kind of things that requires programmatical access to the data is mostly done using 'drawing to the canvas', which in this case is a window spawned by a service.
You should look into overlay activity implementations such as bubbles for android, which lets you peek into the way this is usually achieved, which is by creating a service that adds a window to the system that draws this, from there you can get the screen details, width and height to draw the ruler with.
Inside the spawned window you can add your own subclass of a view that implements the onDraw method in such a way that the ruler is drawn on the canvas.

On Android KitKat, is it possible for an overlay view to fill the entire screen?

With WindowManager.addView and WindowManager.LayoutParams, a view can be added to the screen with TYPE_SYSTEM_OVERLAY, which will then be drawn on top of all other applications. This can be used for various effects, such as colouring the screen or drawing a view which will always be visible. However, I haven't found a way for this overlay to draw over the background that's drawn behind the soft keys.
With the new options to draw in that area supported by KitKat, I figured I could try FLAG_TRANSLUCENT_NAVIGATION and FLAG_TRANSLUCENT_STATUS, but the background is still off limits. FLAG_LAYOUT_IN_SCREEN and FLAG_FULLSCREEN don't seem to help. It seems that the only way to affect the soft key background is by using FLAG_DIM_BEHIND and setting .dimAmount, but this can only be used for dimming the soft key background. Is it possible to actually draw something there, the way it is from inside an activity? If so, how could it be done?

Android real time ECG-type graphs in a PopupWindow

I have looked at some threads concerning real-time line drawing (for items like ECG traces) and all solutions are based upon the idea that the graph is the main activity. What I need is a popup situation where the line graph is drawn only when it is needed.
Can one attach a 'surface' to a PopupWindow? Right now I use an AlertDialog and invalidate() of a Canvas and that stinks as first it is not real time (the entire set of data is drawn then updated so one gets 'flashes' each update) and second the AlertDialog appears impossible to control the size of (same size both orientations) BUT I do see data displayed in the background behind the Dialog box in a scrolled ListView which is the main activity of the application.
I would even be happy if I could get real time drawing in the AlertDialog without this ugly invalidate() though the inability to specify its size is frustrating!

how to make the screen rerender again?

I am doing translation of imageviews in android 2.3.3 using translation animation and disabling/enabling cards accoridngly. Due to the heavyness of this, it seems that there are some "stale" drawing left on the screen (as if the rendering is leaving some random black spots).
Is there a function that I can call which redraws the whole screen as I want my final view (after all the animations are completed) to be clear with no black spots?
Thank you

Android Map Overlay Shifting after AlertDialog opened

I have a map based Android program, that is working nicely, I have it opening an alert dialog when an overlay is clicked...
I start the app, and see my overlays, and all is fine, until I select an overlay. When I select an overlay, my alert dialog appears as expected, but when I close it, suddenly all the annotations suddenly shift down and right a little bit, and then stay shifted from that point on.
It almost seems like the bounds of the overlay suddenly got resent from being set on the middle of the image I am using for the overlay, the top right corner of the image. Is this a KNOWN android issue? I don't have anything in my code explicitely playing with the bounds of the image after I initially set it to the be configured to the center yet this seems to be happening... any ideas?
I figured it out, I was passing the drawable that was my overlay to the AlertDialog to be used as its ICON... apparently the AlertDialog code reset the bounds on my Drawable from being Center Bottom as I had it set up, to top left, and so when I dismissed the dialog and the map redrew all the overlays shifted so that there location was upper right of the Overlay Image and not the center of it from that point forward.
It would have been nice if the API documentation mentioned this.

Categories

Resources