orientation

Activity calling finish in onPause crashes during orientation change

 ̄綄美尐妖づ 提交于 2019-12-24 18:23:19
问题 To preserve resources and prevent memory leaks, I am calling finish() in onPause event whenever app is going from one activity to another. I think it works fine, but when i try to rotate screen, app is crashing - error is "Duplicate finish request" How I can prevent this, is there way in onPause event to detect if app is going to the next activity or just changing orientation? Is there better method for preserving memory then using finish? Thanks for help! 回答1: Just a shot in the dark here,

Using orientation information to get down direction

不问归期 提交于 2019-12-24 17:13:10
问题 I am working on an app that involves drawing a line on my android screen based on its orientation and could use some help or pointers. The line is drawn in the following way: If the phone is held flat then then the line shrinks and becomes a dot and as the phone is tilted and orientatated the line becomes bigger - ie the phone stood up and the line points down and is max magnitude of 9.8 and held flat it is a small dot. Crucialy no matter what angle the phone is held at the arrow allways

how to determine device orientation from the sensors

断了今生、忘了曾经 提交于 2019-12-24 15:19:43
问题 My activity is locked on LANDSCAPE. But still I need to know the orientation of the device. So I have elected to use sensors. I have the following code sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_NORMAL); ... @Override public void onSensorChanged(SensorEvent event) { float[] values = event.values; // Movement float azimuth = values[0]; float pitch =

php iphone/IOS6 upload rotation issue: what is best way to save rotated image

寵の児 提交于 2019-12-24 11:36:53
问题 Using the safari mobile browser with IOS6, the file upload function gives users the option to snap a photo. Unfortunately, upon snapping the photo, while the photo thumb shows up properly in the browser, when you upload to a server, the file is rotated 90 degrees. This appears to be due to the exif data that the iphone sets. I have code that fixes the orientation by rotating the image when serving. However, I suspect it would be better to save the rotated, properly oriented, image so I no

cannot change AVCaptureVideoDataOutput orientation

时光毁灭记忆、已成空白 提交于 2019-12-24 10:54:08
问题 I have a project to use front camera in LandscapeRight orientation for remote communication. when I use the front camera,I need it to work at Landscape orientation,the remote one can get the clear graphs in landscape orientation.I use the following function to changes output orientation of local one and it indeed works in ios5 and 6,but I encountered inverted orientation in my iphone (ios 4.3.3).I don't know why?Does anyone encountered the same problem?? here is the .h file @interface

Allowing both landscape options and accelerometer with libgdx

南楼画角 提交于 2019-12-24 10:53:45
问题 I've completed the SimpleApp tutorial for libgdx. I have changed the controls for the game to use the accelerometer instead of touch input, in the following way: In MainActivity.java cfg.useAccelerometer = true; In DropGame.java float acc = Gdx.input.getAccelerometerY(); bucket.x += acc * 120 * Gdx.graphics.getDeltaTime(); My question is, how do I allow both landscapes? I would like to be able to turn my device 180 degrees from one landscape orientation to the other, and have the game rotate

App auto rotates even with device orientation locked

亡梦爱人 提交于 2019-12-24 10:42:24
问题 I am working on normal activity based application. I have turned off device orientation from device settings. When I run my app on device, the app changes orientation based on device movement. I have no clue how can an app rotate even when device orientation is locked. There is no such instance/issue reported or ever asked on stack overflow or any other forum. Please point out, what I might be missing? 回答1: It was very silly mistake, but I thought of sharing here in case any one else faces

android device angle to vertical axis

送分小仙女□ 提交于 2019-12-24 09:49:50
问题 I am developing an application where I would require to retrieve the angle between the device and the vertical axis (the axis pointing to the center of the Earth). So far, all the documentations and tutorials I found were not very conclusive. Could you please explain me how can I do this or provide me with a link to a clear tutorial to help me find a solution to this problem? 回答1: First, I created a SensorEventListener implementation private SensorEventListener sensorEventListener = new

iPhone portrait-only app starts as landscape on iPad

谁说我不能喝 提交于 2019-12-24 09:48:17
问题 I have an iOS app with the following settings: Devices: iPhone Device orientation: Portrait When I start on a landscape-oriented iPad, however, it shows the launch screen in landscape mode (not properly resized), and the main screen x/y coordinates get switched within viewDidLoad (although the main screen appears in portrait). This does not happen when I run it on iPhone. Any idea how to prevent it? Thanks 回答1: Take a look at you app's info.plist file: Change the config if need. 来源: https:/

iPhone portrait-only app starts as landscape on iPad

帅比萌擦擦* 提交于 2019-12-24 09:42:53
问题 I have an iOS app with the following settings: Devices: iPhone Device orientation: Portrait When I start on a landscape-oriented iPad, however, it shows the launch screen in landscape mode (not properly resized), and the main screen x/y coordinates get switched within viewDidLoad (although the main screen appears in portrait). This does not happen when I run it on iPhone. Any idea how to prevent it? Thanks 回答1: Take a look at you app's info.plist file: Change the config if need. 来源: https:/