I know the question is awful, done thousands of times ; But seriously, I've been stuck for 4 hours trying to solve this. I came into every link from 2009 until today and all of them give the same solution which (**** knows why) is not applying into my case.
This is the activity inside my manifest:
<activity
android:name="com.example.activities.CamerasActivity"
android:configChanges="orientation|screenSize">
</activity>
I'm using SDKs 4.0 or higher:
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
And this is my class:
public class CamerasActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cameras_activity);
VideoView videoView = (VideoView)findViewById(R.id.action_cameras);
videoView.setVideoPath("/storage/sdcard/teste.mp4");
videoView.start();
}
//Still not working
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE)
{
Log.d("System.out", "Welcome to Landscape Mode");
}
else if(newConfig.orientation==Configuration.ORIENTATION_PORTRAIT)
{
Log.d("System.out", "Welcome to portrait mode");
}
}
}
When I run my app like this I can see in portrait mode, works fine. if I use android:screenOrientation="landscape"
on my manifest, I can see forced in landscape mode. This means my layouts are fine but why exactly my onConfigurationChanged
isn't getting called when I try to rotate the screen? What am I missing?
EDIT:
AVD Config:
Auto-Rotate enabled:
Video the way it is:
And no outputs on my logcat.