I am using menu in an activity to display a popup window.
The problem is that when the orientation is changed, the popup window disappears and the activity screen is shown again.
(It happens because when the orientation is changed the Activity is started again)
i want that the activity doesnt start again and after orientation change the popup window doesnt vannish.
please chenge activity in manifest file
put in activity below code
android:configChanges="orientation"
Please make the following changes to manifest where you defined your activity
add this lines:
android:screenOrientation="landscape" or
android:screenOrientation="portrait"
Related
There is an android program
I have a bottom navigation bar inside my app that i don't want to change its orientation because of quality reduce
I want to rotate a fragment inside an activity when change orientation of the phone without activity rotation. how can i do this?
Thanks.
Open your Manifest.XML
Find your activity.
Add tag inside
<activity
android:configChanges="orientation"/>
When finishing an activity (landscape), going back to another activity (portrait), the below screen appears. Why? There is no error message.
Add this : android:configChanges="keyboardHidden|orientation" to the Activity inside your AndroidManifest.xml
I have a listview with two buttons in my main.xml layout. On click of one button i'am creating a textview dynamically and adding it at the bottom of the screen to confirm the user interaction. When the user clicks 2nd button (Confirm button), i need to add that text to listview. To support landscape mode, i have the same layout file in layout-land folder. When i click on 1st button it is creating a textview with some text and adding at bottom of the screen. Now if a change the device orientation then it is loading the landscape main.xml and activity is recreating again. So my textview is getting collapsed. How can i prevent that the recreation of activity on orientation change. (But it should pick up the other layout file).
Just edit the Activity Tag in androidmanifest.xml.
<activity
android:configChanges="keyboardHidden|orientation"
android:name=".testActivity"
android:label="#string/app_name"></activity>
You should add screenSize
if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).
Added in API level 13.
then it should be like this
<activity
android:configChanges="keyboardHidden|orientation|screenSize"
android:name=".testActivity"
android:label="#string/app_name"></activity>
http://developer.android.com/guide/topics/manifest/activity-element.html
I am trying to make a tab activity. It works fine . I make
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" in the definition in manifest file. But sometimes it does not take the full screen when launching. My program starts from a splash screen. That is an normal activity. My tab is at the buttom of the screen. So the tabs are go inside the screen.
Does Anyone know about the problem?
Remove .FullScreen and instead use
android:theme="#android:style/Theme.NoTitleBar"
with your activity tags in AndroidManifest.XML, worked out for me
EDIT
in your Activity onCreate method use
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Let's say I have a basic widget with a button. When i click on this button I would like to display a input dialogue window, still on top of the home screen, where upon entering some value and clicking submit I will see the home screen again.
What I do now is to start an activity with a dialogue which is placed on top of the main activity in my application. Perhaps there is just a simple flag to hide the main activity?
Thankful for any help.
To answer my question, this is what needed to be put in the manifest for my dialog activity.
<activity android:name=".InputDialog"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.Dialog"
android:excludeFromRecents="true">
</activity>