Android Emulator force closes when overriding screen orientation - android

I have an app where all activities have the orientation overritten to be portrait.
This is what a random activity declaration looks like on the Manifest:
<activity
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name"
android:name=".activities.LeaderboardActivity"
android:screenOrientation="portrait" >
</activity>
There's nothing else changed for that matter on the LeaderboardActivity.java.
That code runs just fine on my phone, but when I loaded up the emulator to get some screen shots, it keeps sending me the following error:
"The application Android keyboard (process com.android.inputmethod.latin) has stopped unexpectedly. Please try again"
When I click "Force close", nothing happens, the app keeps running but the error pops up again in less than 10sec, making it impossible to do anything.
Has someone else experienced that kind of problem before?
And it's not a specific problem with my emulator, because all members of my team are getting the same error on their pcs, but not on their phones.
EDIT:
My friend told me he encountered this same problem, and resolved it by opening the AVD manually before starting the app, and only call the app when it's fully loaded. I still haven't tried that, I'll update this when I test this method.

Why are you using android:configChanges="orientation|keyboardHidden" since you are forcing android to stay on portrait orientation? Maybe that's the problem.. did you tried to get it off?

Related

android activity recreate/restart after charged in/plugged in - out

i got this problem in some device, mostly china rom, problem is when plugged-in/out, the onDestroy called, then onCreate called -> activity restart, i tried to find anything of code that relate to this problem but not working.
Can anyone help me know the problem? Thanks
more update:
Here is the sample of one screen
<activity
android:name=".Screen.ChatScreen"
android:configChanges="orientation|screenSize"
android:theme="#style/AppTheme.AppBarOverlay"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
i tested then all screen restarted, not only one, only some specific android device. Samsung work normal

How to permanently disable car mode?

I'm running Android 7.1 and I cannot for the life of me figure out how to ensure "car mode" doesn't start when the device (honeywell CT60) is docked. I've already tried the following:
installing app "no dock"
installing app "car mode off"
getting app devs to add uiMode to the <ACITIVTY> element in the manifest.xml file.
None of these seem to work.
Does anyone have any advice or ideas?
Perhaps even an app that force the device to not go into car mode.
You're on the right track. According to Honeywell the app's AndroidManifest.xml has to be modified in the following way:
<manifest>
<application>
<activity android:configChanges="uiMode">
[...]
</activity>
</application>
</manifest>
This has to be added for each activity, where CAR_MODE should be disabled. It signals to the OS that the app will handle changes regarding the UiMode itself. Now instead of restarting the app to apply changes, the OS will leave handling this change up to the app.
If you want to find out how exactly it works, there already is a post explaining it. Alternatively you can find a guide about this topic at the Android Developer Docs.

My Android application restarts after screensaver appears

Everytime after couple minutes of idle state, screensaver appears on my phone. It makes my Android application restart. Do you know how to overcome this? Of course, I know I could turn off the screensaver, but it's not the solution I am looking for.
What do you mean by restarts? What do you mean by screensaver? If I understood your question correctly you must check if you have this line in your AndroidManifest.xml:
android:configChanges="keyboardHidden|orientation"
This will prevent your activity from being restarted on runtime 'configuration changes'.

How can i stop orientation change in android table?

Hi i am developing android application in tablet version. Here i am facing problem with orientation so i want to make my application in portrait mode only. For that i Used attribute like below snippet for each and every activity in my application.
android:configChanges="keyboard|orientation|keyboardHidden"
android:screenOrientation="portrait"
Application is running perfectly while testing in portrait mode. But it is not good while testing application with tablet physical position with landscape. It is first going to landscape then immediately going to portrait.
I used programmatically making the activity in portrait but no effect. Please provide me any help.
Here is my programmatic orientation fix
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
I tested in Motorolo device
Please suggest me to avoid my application going to landscape.
Try this...
<activity
android:label="#string/app_name"
android:name="abc.xyz.dd.MainScreen"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation">
By adding this in manifest file it will prevent from changing to landscape mode.
Finally i find the reason why orientation changes are occurring in android tablet. In ICS (version 4.0+) the tablet have the option like "Don't keep activities" in settings>> Developer tools>>
If the user checked that option the paused activity will killed and created when it is call again. what i mean the activity won't go for onPause() state it will go for onDestroy() and it will created again when press on back key. So the orientation behavior is different.
I did not get the idea how to handle it from our android code

Android application orientation change behavior

I'm done with developing an android application and in phase of testing it. I've tested it with the simulator and everything is working perfect, but when I deploy it on devices, some of them when you change the screen orientation the application screen starts to flicker.
Any clue where to start the problem investigation from?
When orientation changes from portrait to landscape or vice versa, onCreate gets called again, making the application to start from the beginning. Make sure you are handling it in manifest by declaring android:configChanges="keyboardHidden|orientation" infront of your class name or override onConfigChanged() function.
Please check Both Device version and Developing Application Versions are the same or not, and clear the application after install to the device and then run.

Categories

Resources