开发者

android Orientation of screen creating problem

开发者 https://www.devze.com 2023-04-04 21:01 出处:网络
I have created an App, when my app start its shows a image and I have set ScreenOrientation=\"sensor\" in manifest.

I have created an App, when my app start its shows a image and I have set ScreenOrientation="sensor" in manifest.

but when I rotate my device my app crashes.

sometime its shows image in portrait mode or landscape mode.

can anybody please help me.

how can I set orientation of screen accor开发者_如何学Goding to sensor.

Thanks


your activity in your Manifest file is:: and also stop or intrupted yout thread while completing the work

Main problem is your background Thread is running and when you change orientation the new view is generated and try to access old view so app crashes....

<activity android:name=".SensorTest"
        android:windowSoftInputMode="adjustPan"  android:screenOrientation="sensor"
        android:configChanges="keyboardHidden|orientation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
        </intent-filter>
    </activity>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号