CopyPastor

Detecting plagiarism made easy.

Score: 0.7732611298561096; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2018-09-21
by Viral Patel

Original Post

Original - Posted on 2017-06-27
by saigopi



            
Present in both answers; Present only in the new answer; Present only in the old answer;

In Activity file :
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); checkOrientation(newConfig); } private void checkOrientation(Configuration newConfig){ // Checks the orientation of the screen if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { Log.d(TAG, "Current Orientation : Landscape"); // Your magic here for landscape mode } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){ Log.d(TAG, "Current Orientation : Portrait"); // Your magic here for portrait mode } }
AND in Manifest file:
<activity android:name=".ActivityName" android:configChanges="orientation|screenSize">
I hope it'll help you ..!
use this method
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { Toast.makeText(getActivity(),"PORTRAIT",Toast.LENGTH_LONG).show(); //add your code what you want to do when screen on PORTRAIT MODE } else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { Toast.makeText(getActivity(),"LANDSCAPE",Toast.LENGTH_LONG).show(); //add your code what you want to do when screen on LANDSCAPE MODE } }
And Do not forget to Add this in your Androidmainfest.xml
android:configChanges="orientation|screenSize" like this
<activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.NoActionBar" android:configChanges="orientation|screenSize"> </activity>

        
Present in both answers; Present only in the new answer; Present only in the old answer;