Android的屏幕方向,摇手机的应用程序崩溃 [英] Android Screen orientation, shake cellphone crashes the application

查看:90
本文介绍了Android的屏幕方向,摇手机的应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有搜索应用程序,它加载从WebService retreived数据。

I am having search application, which loads data retreived from the webservice.

虽然在创建它的应用程序显示进度对话框,一旦它与数据加载完成其驳回进度对话框。

While application on create it shows progress dialog once its done with loading data it dismiss the progress dialog.

问题是同时加载,如果我更改手机的正常工作就尝试再次装入活动的方向,但如果我开始晃动手机,它加载数据的应用程序来时坠毁,任何解决方案???

problem is while loading if i change the orientation of the phone it works fine it try to load activity again, but if i start shaking the cellphone while it is loading data application get crashed, any solution ???

推荐答案

android:configChanges="keyboardHidden|orientation"

在你活动XML标记。

和添加这些code你activity.java

and add these code to your activity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
}

这篇关于Android的屏幕方向,摇手机的应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆