0

So there are lots of SO posts on this topic but neither working in my case.

Orientation is not calling any method of activity.

I tried all possible ways mentioned like:

Putting android:configChanges="orientation|keyboardHidden|screenSize" in the calling activity.

Then putting onConfigurationChanged method as:

@Override
    public void onConfigurationChanged(Configuration conf) {
        super.onConfigurationChanged(conf);
        System.out.println("on onConfigurationChanged called..............");
    }

But its not getting called.

onCreate(), onResume(), onRestoreInstanceState() methods are also not getting called when I do change the screen orientation.

Further, I changed the sdk versions and target versions but without success.

UPDATE:

My part of activity from manifest from activity is:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.wassap.main"
    android:versionCode="1"
    android:versionName="1.0" >

  <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16"/>

        <activity
            android:name=".UserActivity"
            android:label="@string/app_name"
             android:launchMode="singleTask"
             android:configChanges="orientation|keyboardHidden|screenSize" >
        </activity>

Relevant UserActivity XML-

           <LinearLayout
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:orientation="horizontal"
             android:clickable="true"                
             android:onClick="buildDocument">

           <TextView
             android:id="@+id/title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="Build Document">
           </TextView>
        </LinearLayout>

UserActivity class is the class in which I do orientation after onClick buildDocument.

When I am in UserActivity, probably by a click of buildDocument, I also noticed that destroy() method is also not called when I go back clicking on back button.

All in all, no life cycle method seems to be getting called.

4

1 回答 1

0

终于做对了。在启动它的用户活动中调用了其他活动,因此当前活动不是要考虑的相关活动。在另一个活动中,我添加了记录器来检查方向变化及其工作正常。

于 2013-05-03T12:26:25.810 回答