I am trying to create a custom device with Android and I have the device working well with at this point (looks good visually & with touch). The issue I am having is that the touchscreen does not always agree with the screen orientation. Here is the problem:
The device is set up as a tablet, and will be affixed to a table. But I want to make one version that can be used as a left-hand unit (with a small control section on the left) or a right-hand unit and have the splashscreen change with the unit orientation. My LCD allows me to flip it 180 degrees using a switch, and I can read in that signal on my processor. The problem is that when I flip the screen with the switch, the touch sensor does not come with. Where would I change this configuration? I have access to the AOSP source code, and can build custom ROMS, so that is not an issue.
Now you may also respond that I could use the accellerometer, but the issue with that is that I would see a couple of seconds of the screen being upside-down, and then the reorientation. I need it to boot up as flawlessly in the correct orientation as possible.
What I need: A place in the source code or a setting that I can change in Android that would let me change the touch screen orientation without changing the screen orientation.
Thank you for your help!
Related
I am using a portrait (native) display in landscape mode by using setprop ro.sf.hwrotation 90 in KitKat and it is working well. The problem is that the screen momentarily flips/twists before going to the correct orientation when a USB keyboard is connected or disconnected. The aspect ratio is momentarily distorted as well (e.g. clock becomes an oval). The distortion only persists for a moment - but something is not correct.
This twist doesn't occur unless the ro.sf.hwrotation property is used - so I'm thinking that someplace in the Android source that needs to take it into account isn't.
Thanks in advance,
You can try handling the keyboard configuration change yourself, and that'll stop the activity from being recreated and causing the momentary distortion (see docs here)
I am developing a mobile app with Delphi XE5, Android platform.
I need one form in my mobile FireMonkey app to keep it's set orientation and not change when device is turned. Other forms however can change orientation when device is turned.
How can I accomplish this?
Delphi XE5 does not provide any setting on the form to do this, and one cannot make one form never rotate whilst others do. You can perhaps create a work-around solution but a lot of testing would be required to ensure it works on all devices. Probably not a good idea.
The FormPaint event is fired after the form repaints (when rotation is changed and other actions). The form Height & Width will give you the current size and if you have a list of devices form sizes you could work out whether the form is currently in portrait / landscape mode. You cannot force the form to another orientation, but you can hide controls and display a message.
Not easy and possibly not worth the effort.
I have a Geniatech ATV1220 android set top box running android 4.2.2 and am using an arduino with motion sensor connected to it to modify content on a website when someone is in front of the sensor via NodeJS.
This works great, but what I would like to do is to manipulte the complete system viewport of the android system. For example if someone steps in front of the sensor, the whole system should be displayed in a reduced size like 1/4 original at the bottom right side of the screen while the other area should just display black or basically nothing.
It is really hard to find something because of the pretty common keywords like display, viewport, size and so on. I could probably do it dependent on individual applications but I also want to use it in third party applications, which I cannot modify.
Currently I am sometimes using commands like this:
echo 1 >/sys/class/graphics/fb0/blank
to modify the actual content that is displayed, in this case it all turns black/blank and I wonder if there is a similar way to achieve what I want to do. Any help is greatly appreciated.
What worked in the end was using the Xposed Framework and installing "One-handed mode" like explained here: How to get a one-handed mode on almost any rooted Android device.
I have two questions that I can not answer to myself:
How can I change the size of my window, if I do not know the exact size of the phone screen? I.e. my aim is to fit all screen sizes.
Is there any difference between clicking with mouse and touching with fingers in the code? If I write code for clicking, will it work with touch?
On mobile, your app should automatically fill the phone screen. You don't need to worry about it. On desktop, you can use the --size=WxH option to test a specific screen size, or use the screen module (-m screen:nexus7 for example - run kivy with -m screen to see the available options).
No. All mouse/touchscreen interactions are considered touches in Kivy. So using on_touch_down/on_touch_move/on_touch_up will work regardless of the input device. The only difference is that with touchscreen you could have multi-touch - but if you write your app assuming single-touch it will work the same on both mobile and desktop.
Hello :) I am working on an application that uses the compass and location to draw an arrow at the direction of a location. My problem is when I run my code on the emulator, all the arrows point the correct directions, and when I change the orientation of the emulator to landscape, all the arrows are still correct. But when I run the same application on my Nexus One, the arrows are all correct when the phone is vertical, but when it turns to landscape all of the arrow are off by 90 degrees. It keeps the "top" of the phone as the reference to North. Thus you must correct the compass for the orientation of the phone. Does this happen on all real phones and the emulator is the different one? Or is this just the Nexus One? Thanks :)
From my understanding the current way the compass works it is supposed to always use the "top" of the phone or "default orientation" for the correct reading. This could have been different on earlier versions of android. It is said it is then up to developers to compensate for the screen orientation to represent the true north with orientation changes. Same goes for the accelerometer the axis stay based off of default screen orientation (so for most phones portrait, but tablets most would be landscape).
I hate to refer you to the sdk but this link first paragraph explains:
http://developer.android.com/reference/android/hardware/SensorEvent.html