android-orientation

How to get android video capture to survive screen rotation

断了今生、忘了曾经 提交于 2019-12-06 10:51:31
I have managed to get Video capture to work for a custom camera experience (i.e. using MediaRecorder, Camera, SurfaceView, etc.). But if I am recording a video and change the orientation of the device, video capture stops. Is there way to continue the capture after the orientation change? If fact I want the capture to continue no matter how many times the orientation changes. I imagine it might all have to do with savedInstanceState and saving the file that I pass to mRecorder.setOutputFile(my file) . If that's correct, what else am I missing? Or is there a more standard way to handle

Get Euler Yaw angle of an Android Device

余生长醉 提交于 2019-12-06 09:32:07
问题 I'm trying to get yaw of an android device expressed in euler angles. To be clear i dont want 'Azimuth' (which is the angle to magnetic north) I want the rotation of the 'z' axis of an android device as shown in this picture. This (IMHO) should be the axis used in some car games to determine the amount of steering. It is my understanding I could just use the Accelerometer values (without the magnetic fields) but I'm unable to get the determined value. (probably due to a lack of understanding

Android emulator camera - webcam orientation

风流意气都作罢 提交于 2019-12-06 01:38:58
问题 I am using my Mac webcam to simulate an Android front-camera in the emulator. Unfortunately the camera seems in landscape orientation - screenshot, even though the emulator is in portrait one. Note that the camera behaves properly on a real device (i.e. it has a portrait orientation). My Emulator configuration: Nexus 5X, Android Nougat 7.1.1, API Level 25, Startup Orientation: portrait, front-camera: webcam0, back-camera: Emulated How can I use the webcam with proper orientation? 回答1:

Disable and enable orientation changes in an activity in Android programatically

故事扮演 提交于 2019-12-05 20:57:00
问题 I have an App that make some background staff. When the background work is running a progress Circle is shown, if the device is rotated during this time then the Activity is "reset" and I want to avoid that. For this reason I decided disable orientation during this process. I have seen differends threads for this question but none with a valid solution, at least in my case. The solutions posted are about fixing the activity orientation but you have to deal with the fact that the REVERSE

Keyboard disappears on orientation change

北城余情 提交于 2019-12-05 17:25:14
I have a fragment with EditText and add it into the layout using transactions. But if I rotate to landscape the soft keyboard disappears. public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (getSupportFragmentManager().findFragmentById(R.id.fragmentContainer) == null) { getSupportFragmentManager().beginTransaction() .add(R.id.fragmentContainer, new FragmentWithEditText()) .commit(); } } } I want keyboard state still unchanged after rotate using

Android webview retain form data when orientation changes

拜拜、爱过 提交于 2019-12-05 13:27:42
How to retain the form data in the webview after the change the orientation ? I have used onSaveInstanceState() and I have restored the previous state using restoreState(savedInstanceState) . This successfully restores the previous state before the change in orientation but it does not restore the data in the text box of the form in the webview. What should be done to retain the data in the text box of the forms in webview after the change in orientation ? Note: I would not be using android:configChanges="keyboardHidden|orientation" as I need keyboard input for my application after orientation

Android: Rotate only overlay Buttons on camera preview

不问归期 提交于 2019-12-05 06:30:48
I have an Android application using LinearLayout as main layout with a SurfaceView filled by camera preview. In this I inflate another LinearLayout with three Buttons and a custom TextView. I would like the camera preview to stay always in Landscape orientation and the overlay layout changing according to the device orientation. I tried setting android:screenOrientation="landscape" in the manifest for the activity but then (of course) also the inflated layout stays always fixed, while not setting the android:screenOrientation property also the camera preview rotate, slowing down the app and

Android: How to save custom finger paint view on orientation change

穿精又带淫゛_ 提交于 2019-12-05 02:39:37
问题 I'm trying to create a custom view where a user can draw their signature. One where you can put it into the view programmatically and set the size, etc. I haven't had to do this before so I based it off the fingerpaint class from android api demos. Problem right now is that it erases the object on orientation change and I'm not sure how to get it to not do that. The code for PaintView private Bitmap mBitmap; private Canvas mCanvas; private Path mPath; private Paint mBitmapPaint; private

Get Euler Yaw angle of an Android Device

僤鯓⒐⒋嵵緔 提交于 2019-12-04 18:35:23
I'm trying to get yaw of an android device expressed in euler angles. To be clear i dont want 'Azimuth' (which is the angle to magnetic north) I want the rotation of the 'z' axis of an android device as shown in this picture. This (IMHO) should be the axis used in some car games to determine the amount of steering. It is my understanding I could just use the Accelerometer values (without the magnetic fields) but I'm unable to get the determined value. (probably due to a lack of understanding of how rotation matrixes works). Can someone point me toward the right direction? Hoan Nguyen If you

Activity return to Portrait when Screen is Locked

99封情书 提交于 2019-12-04 11:44:34
Related questions: https://stackoverflow.com/questions/15648713/strange-behaviour-while-screen-lock-in-landscape This is a strange behaviour i got in my Activities. Portrait mode (It's normal) Press screen lock, Activity: onPause() ; Unlock the screen, Activity: onResume() . Landscape mode (It's strange) Press screen lock, Activity: onPause() -> onStop() -> onDestroy() -> onCreate() -> onStart() -> onResume() which loads the Portrait layout; Unlock the screen, Activity: onPause() -> onStop() -> onDestroy() -> onCreate() -> onStart() -> onResume() and loads the Landscape layout. What I expect