Search code examples
androidandroid-actionbaractionbarsherlockstatusbar

Starting new activity from fullscreen activity causes status bar to cover action bar


I am using ActionBarSherlock lib. I have CameraActivity which has style set to fullscreen:

<activity
   android:name="pl.toptof.android.ui.activity.CameraActivity"
   android:theme="@style/Theme.Styled.NoActionBar.fullScreen"
   android:screenOrientation="portrait">
</activity>

When I start new activity from this activity like that:

Intent intent = new Intent(CameraActivity.this, PreviewActivity.class);
intent.putExtra("PhotoURI",takenPhotoURL);
intent.putExtra("voteID",voteId);
CameraActivity.this.startActivity(intent);

Activity looks like it stayed in fullscreen mode and status bar is visible, and cover my actionbar. Theme of Preview activity is:

<application
        android:name="(...)"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:hardwareAccelerated="true"
        android:theme="@style/Theme.Styled">

<activity
            android:name="pl.toptof.android.ui.activity.PreviewActivity"
            android:screenOrientation="portrait">
</activity>

The problem appears only on Sony Xperia Z device. On HTC Legend, HTC One, Nexus 4, Samsung Galaxy S3, Nexus 7, Samsung Galaxy Note it works fine. And screen of it:
status bar covers action bar

Any ideas how to fix it?


Solution

  • Problem is fixed. What I have done is:

    I have modified this way of starting new activity by

    Intent intent = new Intent(CameraActivity.this, PreviewActivity.class);
    intent.putExtra("PhotoURI",takenPhotoURL);
    intent.putExtra("voteID",voteId);
    CameraActivity.this.startActivity(intent);
    

    adding

    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    before startActivity method. It's a bit tricky but status bar is sliding down before activity ends and everything works fine. When I return/start CameraActivity again it gets FLAG_FULLSCREEN onCreate again.