libGDX Causing Multitouch Problems - java

I am working on a game with a virtual joystick in the bottom right corner of the screen and a "move" button in the bottom left. So you use the joystick to point the character in the right direction and press the "move" button to go forward in that direction. This was all working great until today and now when I press on the screen to go forward my joystick is being affected. I know it is not a coding problem because I haven't opened the file that handles touches for 8 days and it has been working fine. Also after I close my app and then use another app that is completely separate from libGDX the multitouch is having the same issue. So do you guys think this is a problem with libGDX, my device, or am I just not coding the multitouch correctly for libGDX? I am using a Stage and the controls are Actors on the Stage I should note that after I restart my phone, the other app that is not using libGDX works correctly. It is only after I open my libGDX based game. So frustrated with this that I am about to give up on libGDX. I am happy to post any code that is requested.
EDIT: Please see comments below. This seems to be a specific issue with the Galaxy Nexus and probably some other Samsung devices as well. This libGDX based app has had no issues on other devices such as original droid, and ASUS Transformer tablet.

Turns out this is not a libGDX problem at all... Nor was it a problem with any of my code. There seems to be a bug in the way the Galaxy Nexus handles multitouch. You can view the bug report at this link. Seems that as of 4.0.4 there still is no fix for this bug. I am still currently running a VZW Galaxy Nexus with 4.0.2, I guess all we can do is wait and put a disclaimer in our games until (if ever) it is fixed.
By locking and unlocking the device, the problem does go away (sometimes), but will quickly come back if I go to my homescreen and re-open the app.

Related

Autofocus in Samsung S8+

A wrote an application using a camera (Camera2) some time ago. And it worked with Samsung S5 (Android 6). But with S8+ (Android 8) camera doesn't focus anymore. It's going from CONTROL_AF_STATE_INACTIVE to CONTROL_AF_STATE_ACTIVE_SCAN to CONTROL_AF_STATE_FOCUSED_LOCKED (and then cycles through last two states) but the camera doesn't focus.
But when for the first time I postpone autofocus start (for example for 1 - 2 seconds after opening camera device) camera focuses - but only this time. And then it backs to cycling through these states without focusing.
The only thing that helps is reopening camera device but it's unacceptable because of delay.
I was trying to use CONTROL_AF_MODE_CONTINUOUS_PICTURE instead of CONTROL_AF_MODE_MACRO and this works for S8 but doesn't work for S5 :/
Does anybody have an issue like this? I'll try to prepare SSCE but maybe somebody knows what to do?
this is a know glitch ...the Samsung forums have a possible solution:
https://us.community.samsung.com/t5/Galaxy-S8-Questions-and-Answers/Camera-Not-Focusing-and-Blurry-Photos/td-p/103058 - which appears to be a manufacturing / mechanical issue.
tapping the back might loosen the stuck lens (eg. while it switches the modes back and forth). I'd still check for the occasion, that it may still behave alike that when running on some other S8+ device. it's not exactly what one would expect from a brand-new smartphone, but there seems to be too little precision at the lens clearance. maybe try to RMA that device?

Android Studio - AVD doesn't recognize gestures (cant unlock emulator)

I just started learning to program for android and sadly after making one program (Hello World) I have already ran into an issue. The gesture for "Swipe to Unlock" or for the camera are not functioning. I can bypass it on the stock emulator because it shows a notification i can click that will skip the screen, however i would much rather just figure out a solution, i have searched around on Google and StackOverflow to no avail... maybe someone can help out.
Thanks in advance,
Jon
ok solved! for those that might have the same problem, just press f2
adb shell input keyevent 82
I had the same issue and grew tired of it, this always worked.
AVD_WXGA_TABLET emulator.
Android v 7
F2 does nothing.
Dragging with left-down mouse tries to do a swipe up but bounces back down when I release the mouse.
I've tried fast and slow, release on the virtual device or off it. Short and long strokes. You name it...
The f'ing thing won't unlock. And for all the keystrokes available in the tool pallet including fingerprints, there is no simple swipe-left/up/down/right. You'd think they would have had cntrol-alt-arrow for that out of sheer common sense or as the result of the developer trying to use it.
In my case, I just restarted the simulator by holding down the "Power" button in the simulator menu for a couple of seconds and then choosing "Restart." I was able to unlock the simulator easily after that.
I'm not sure exactly which step solved it, maybe all, but these were my steps
Use the SDK manager to update to the latest version of the emulator
Turn off the emulator (hold the power button and select Power Off)
Close Android Studio
Reopen Android Studio
Launch the emulator from the AVD manager
On mac you can keep holding the command key and then do the swipe gesture with the mouse or trackpad of your computer.
Video
Try using one of two ways
Swipe up from top section of screen
Swipe up from bottom section of screen i.e. just above the navigation buttons.

How to programmatically clear the Camera cache in Android?

I have an issue with Samsung Galaxy tablets. When my application triggers the camera flash, the image gets dark. I never noticed this issue since I was doing testing with other brands. But, recently, I just stared testing with Samsung Galaxy and I found out that issue.
After several days doing research I found that one way to temporally solve it could be clearing the camera cache. Effectively, that works if you do it through the device camera setting, but I need to do it now by code, since I would like to trigger that event before the user uses the camera flash.
How can I accomplish that programmatically ?

How to render mouse movement in android tablet

I have one linux laptop and one android tablet. I want to show my mouse movement in my android tablet that is i will move mouse in linux laptop and that movement will be shown on android tablet.Will libgdx will work for this??Is their any good study material or sample program to start ?
There was a Libgdx Remote project, but that went in the other direction (pushing Android sensor data to your desktop so you can debug tilt code on your desktop). However, I believe that's been deprecated in the most recent builds.
The remnants of that project are the RemoteInput
and RemoteSender classes. You may be able to adapt those for your case (setting up your Android device to be a network listener may be more work than forwarding mouse events).
This approach may be much lower-level than what you want (you may just want to get mouse coordinates from your laptop and map them directly to drawing something on the screen -- and not inject low-level events).

Application crash on power button

I am making a game(Landscape mode) in AndEngine GLES 2.0 and facing very weird problem. When I press power button -> power button -> unlock phone, the game restarts automatically. I've done some testing:
Not working:
Galaxy Nexus (4.2.1)
Xperia Pro (4.0.4)
Working:
Xperia Pro (2.3.4)
I wonder if there is some change in the power button management of 4.0. and above?
If I change my game to portrait mode then there is no problem at all.
I also have placed the orientationChanged settings in the manifest but the problem still exists
I had a problem that was similar, but not resulting in an application crash. Just that the game did not restart successfully. It turned out the problem for me was using static references.
Your problem may be caused by your textures. I don't think its documented anywhere, but using ANY static reference to a texture can cause a number of bad outcomes when resuming a game. However its fine to use a Singleton to manage your textures.

Categories

Resources