I am working in an android project targeted for Samsung Galaxy Tab E in Landscape.
The android application starts on boot(as per requirement), after booting, Android by default loads in portrait and switches to Landscape quickly.
The app is already started(Though screen is locked), but the working area in app would be only the width equal to the width in portrait.
This issue appears when screen is locked and orientation of tablet is set to Landscape.
With reference of attached picture in link https://i.stack.imgur.com/4K5Ul.png.
P : is screen when in portrait.
L : is screen when in Landscape.
A : is working portion of L (Whose width is equal with width in portrait mode)
B : is NON-working portion of landscape.
This issue is resolved, and I have explained my case and solution which might be useful for other developers with similar issue.
The issue was not with android application itself. The issue was because android starts my application before boot completion. In my project, android app would run in accessory mode, controlled from another device.
Once the external device gets tablet during restart/power on, my android application starts to run before boot completion, I made another application (app of external device) which sends request to accessory device to sleep for a while when new device is found, so that tablet has enough time to boot and can start app.
Thank you!
Related
I've just noticed this quirk with android emulators. They seem to always photo in landscape mode, even when the phone is in portrait mode. This isn't a problem when running the actual code on a live device.
Why does android emulator do that?
Let say I have an application designed to open other applications just like a apps screen on android phones. I wanted to keep the device in landscape. At the same time, if other applications designed to be working in a portrait mode, I wanted to show as Portrait in a landscape screen rather than stretch the application to fit within the landscape screen.
This is the screenshot as an example:
The red shape is the application running in portrait.
The black shape is the screen of the device in landscape.
At the moment, my application will load the portrait app in full screen mode which the red shape will be fill the whole screen.
P.S. The device I am using can be rooted.
My launcher at the moment can load the application and cause the application to rotate into portrait on a Portrait screen.
Spending days of finding. The solution is to root the device and calling wm size 300x800 or any number as a su privilege in code.
The way to root the emulator to test can be found in here:
https://android.stackexchange.com/questions/148841/attempt-to-root-avd-running-android-4-4-5-1-is-failing
Use the appropriate API Level as stated in the answer. Otherwise it may not work.
The way to call the su command :
https://github.com/neoimale/android-screen-mock/blob/master/ScreenMock/src/com/dianping/screenmock/MainActivity.java
I'm writing a chat app in which I have two different layouts for normal and large devices, similar to the Telegram app. I have an MainActivity that on non-large devices has only a fragment containing the list of chats in it's layout.xml. On large devices the layout.xml also includes a fragment, where you can write in the chat.
My problem is, that on large devices (e.g. Nexus 9 Virtual Device) the app rotates fine when I rotate the device, the activities are reloaded etc. But on non-large devices the app won't rotate after it is started. I have tried this on Nexus 5X API22 and Nexus 5 API23 Virtual Devices and on a OnePlus X and a Samsung Galaxy S7 Edge, all with auto-rotate activated. There is nothing in the AndroidManifest or anywhere else in my code, that has any influence on configChanges. I let Android handle them and don't handle them myself.
I can get the app to rotate on non-large devices when I open the app, got to overview or start another app, rotate to landscape and then go back to my app through overview. After doing this, it reacts normally to rotation. This means I can then rotate it around and the layout/activity is reloaded accordingly by Android.
I couldn't find anything on this anywhere, neither on SO, nor through googling. Please help me, if you have any ideas, where this problem could stem from.
I have a project requirement to create a kiosk based application which will always be in the landscape mode,for which I am making use of a tablet running on 4.2.2.One of the modules has the functionality to make phone calls.For making the calls from my app, I invoke the default android dialer app.However,I notice that even if my device is physically in the landscape mode,at times when the default dialer app is called,it first displays its portrait layout and the quickly switches to the landscape one(which is not visually appealing).Now,since I do not have access to modify the source code of the default dialer app,I was wondering if there is a way that I can specify a system level screen orientation as landscape ?
PS: I have root access for my tablet.
Any help would be appreciated.Many thanks !
There's an app for that: Rotation Locker
You can also add the switch ro.sf.hwrotation 90 in your build.prop file
I'm working on an application that will appear on the home screen that I've been testing on my phone in debug mode. However, none of the five phones I have will switch the home screen into portrait mode, making it impossible to test my app in portrait mode. I know that ctrl+F11 will rotate the emulator between portrait and landscape modes. However, much like my physical phones the emulator, when rotated to landscape, simply displays everything sidewise at a 90 degree angle.
Is there a way that the emulator can be setup to allow a landscape home screen? If not, how does one test an application that requires that short of buying one of the few phones that support it?
you can press Numpad 7 to rotate the emulator