screen-rotation

The AsyncTask fails when I rotate the device to landscape

狂风中的少年 提交于 2019-12-13 16:19:55
问题 I have an Activity in which I have a ProgressBar ,an ImageView and a TextView ,I update all three from an AsyncTask .All three get updated when the screen is completely in one orientation when the task is running,but the ImageView and TextView are not displayed and the ProgressBar freezes when the screen orientation changes from one orientation to another. Adding the attach and detach methods to the task and using retainNonConfigurationInstance to return the task when the Activity and using

App crashing after i rotate device and click the menu

☆樱花仙子☆ 提交于 2019-12-13 07:15:40
问题 I have a navigation drawer with fragments and my app is crashing after I rotate the device and click on the menu. My code on main activity is: public class MainActivity extends FragmentActivity { private DrawerLayout mDrawerLayout; ImageView home; Fragment fragment = null; TextView appname; ExpandableListView expListView; HashMap<String, List<String>> listDataChild; ExpandableListAdapter listAdapter; List<String> listDataHeader; @Override protected void onCreate(Bundle savedInstanceState) {

Rotate the Activity with click on a Button

独自空忆成欢 提交于 2019-12-13 07:08:39
问题 I am using this CODE to disable the auto rotate in my App: android:screenOrientation="portrait" What I want is to write a CODE inside my Activity to make the App on portrait or landscape as the user want by clicking a button and save it in SharedPreferences. I am already made layout and layout-land with different design but as i disabled it in my Manifest its is not showing up, Cause i want the users chose what they want! Thanks for any Help UPDATE /** Here is the Rotation Button */ View

horizontal uiview's controls unresponsive.. or how to foul up a view hierarchy

浪子不回头ぞ 提交于 2019-12-13 05:20:46
问题 I'm working on an app that has two sections, a config section and a results section. My config section needs to be 2 separate views (horizontal and vert, and yes, I can hear the intake of breath from here), with one rotatable view for the results. b/c of layout restraints and a lot of pain around rotation, I'm not using a navigation controller. I've been experiencing the joys of rotation experimentation and have settled upon keeping my views contained as subviews of my view controller. i.e.

int variable does not save with screen rotation

戏子无情 提交于 2019-12-13 03:44:49
问题 I put an imageview to load an image of a url, it is when I click on a button it passes to the next url, thus changing the image. the problem is that when I rotate the screen it returns to the first image displayed. I tried to do an if with incremented counter but it deletes the variable and returns to the first one again. someone knows how to save the value of the "next" variable so when the screen rotates it keeps the value saved, or knows another way to keep the last image saved. api

why using android:configChanges is a bad practice

戏子无情 提交于 2019-12-12 09:37:07
问题 I have gone through different posts and questions for handling rotation and AsyncTask . In each post it is mentioned that using android:configChanges is a bad practice. But i didn't find the actual reason why it is discouraged and why it is a bad practice. What are the disadvantage if we use android:configChanges to handle orientation. Note: I know it is already answered how to handle orientation and AsyncTask . but I want to know reason behind not using android:configChanges . 回答1: Well, you

How to restore textview scrolling position after screen rotation?

妖精的绣舞 提交于 2019-12-12 07:18:44
问题 In my Android Layout, I have a TextView. This TextView is displaying a rather large spannable text and it is able to scroll. Now when the phone is rotated, the View is destroyed and created and I have to setText() the TextView again, resetting the scroll position to the beginning. I know I can use getScrolly() and scrollTo() to scroll to pixel positions, but due to the change in View widths, lines become longer and a line that was at pixel pos 400 might now be at 250. So this is not very

Rotation issue from the first view (splash) to first viewController

痞子三分冷 提交于 2019-12-12 04:48:26
问题 I am working in Xcode 4.5.2, targeting iOS6 for an iPad app, using storyboards and segues. Preamble: my root controller (loaded by the app delegate) is a splash screen with only an image, an upgrade button and an open button. App takes a few seconds to load. I have shouldAutorotate and supportedInterfaceOrientations in all three of my full screen controllers. For rotation notification, I am using the following two methods in my root view controller: - (void)awakeFromNib { [UIDevice

Rotating only affect one time in iPad in swift 3

不羁的心 提交于 2019-12-12 04:06:20
问题 I have 2 view controllers. First view controller has many videos and when user clicks on the Video, then it will goes to second view controller. When user reaches to second view controller, then the screen will rotate automatically to the landscape mode. But, user rotates the device and the video display will rotates to portrait and cannot set to landscape mode anymore. --------------------- I set some config in Project > General. I would like to set landscape whatever the user rotates the

Restore changed menu state after rotation of a device

混江龙づ霸主 提交于 2019-12-11 14:02:21
问题 I'm writing an application, which has a menu with buttons and an image. I press the button and label of the button changes from "Record track" to "Stop recording". The issue is when I rotate my device, the activity with buttons gets killed by the OS. So, I understood that I have to save my data before it's get killed in onSaveInstanceState method and then restore it in my onCreate method. Something like this: @Override public void onSaveInstanceState(final Bundle saveInstanceState) {