android-orientation

What happens with view references in unfinished AsyncTask after orientation change?

*爱你&永不变心* 提交于 2019-12-13 02:34:28
问题 Note this question was inspired by a comment to https://stackoverflow.com/a/33370816/519334 . I have a holder class that belongs to a GridView-item with a reference to an ImageView public static class Holder { ImageView mRowImage; String mImageUrl; // neccessary to cancel unfinished download BitmapLoaderAsyncTask mDownloader; } The corresponding GridItemAdapter uses an AsyncTask to get the image for the GridItem public class GridItemAdapter extends BaseAdapter { @Override public View getView

Android Lock Orientation and Double Create

China☆狼群 提交于 2019-12-13 02:05:07
问题 I want to make my application displayed only in portrait orientation, so I have put android:screenOrientation="portrait" in the Activity tag in AndroidManifest.xml , and have put setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); in the Activity's onCreate method. This works to lock the orientation to portrait, however, when the Activity starts, it shows itself once, then shows itself again, so you see a sort of flash. I can confirm that onCreate is being called twice as well.

Rotate an ImageButton on orientation change

与世无争的帅哥 提交于 2019-12-13 00:21:08
问题 I have an image button that I want to rotate when the orientation of the device changes. How can I rotate the image with some animation or transition ? 回答1: try this code snippet. rotate.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="0" android:duration="2000" /> </set> rorate_anticlockwise.xml <?xml version="1.0"

Android activity restart(due to screen orientation changes) issue solutions provided on stackoverflow dont work for me

北城余情 提交于 2019-12-12 23:37:54
问题 I am making a demo app to illustrate how I handle screen orientation. It is a simple counter app that increments the count when the user presses the increment button and viceversa. Here is my code, I included android:configChanges="keyboardHidden|orientation" in manifest file and also overrode onConfigurationChanged method. But unfortunately, I am unable to preserve the value of the count and when I switch emulator to landscape orientation the count is reset to 0, how do I go about this

onBackPressed() Orientation Issue

好久不见. 提交于 2019-12-12 19:53:37
问题 Activity supports Landscape mode <activity android:name=".MainActivity" android:configChanges="orientation|screenSize|keyboardHidden" android:screenOrientation="landscape" android:label="@string/app_name" > where I have allocated 50% space to Video Player (using FrameLayout) and rest 50% to ListView . <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"

How to change the position of layout when the orientation of screen change in android?

﹥>﹥吖頭↗ 提交于 2019-12-12 10:43:45
问题 How to change the position of layout when the orientation of screen change in android ? I have a button in the Relativelayout . When the phone is LANDSCAPE , the Relativelayout is at the bottom. And it turn to the right of screen , when phone is PORTRAIT . It like the following picture. I get the orientation of screen , but how to setting the Relativelayout change it position from bottom to right ? ----------------------------------EDIT---------------------------- The code of xml in layout

How can i detect orientation changes in portrait mode in android?

自作多情 提交于 2019-12-12 05:29:06
问题 I need to show a camera preview in my app so that the photos can be taken by pushing a button. So I put a pretty "standard" camera preview class. The problem is I have to put it in landscape mode so that the preview can stretch on the entire screen. If in portrait mode, it will remain only on the center of the screen, on a small part of it. If this can be solved easier, I am open to suggestions. But my question is. If locked in landscape mode, how can i detect screen rotation so that i can

Fragment + ViewPager fail when orientation change

痞子三分冷 提交于 2019-12-12 04:12:30
问题 I have one FragmentActivity, with one ViewPager and one FragmentStatePagerAdapter. When i change the screen orientation screen on viewPager, i can see the viewPager but not the fragments. I test all post on Stackoverflow. FragmentStatePagerAdapter public class PageAdapter extends FragmentStatePagerAdapter{ private static final String[] CONTENT = new String[] { "All", "Installed"}; List<Application> applicationList; public PageAdapter(FragmentManager fm,List<Application> applicationList) {

Layout not refreshing after orientation change

不问归期 提交于 2019-12-12 00:35:31
问题 I have the following Activity definition: <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/inspectionMainLayout" xmlns:android="http://schemas.android.com/apk/res/android"> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:singleLine="false" android:id="@+id/breadCrumb" android:visibility="gone"> </LinearLayout> <ExpandableListView android:layout_width="fill_parent" android

ScrollView not scrolling and application restart on orientation change

孤者浪人 提交于 2019-12-11 23:57:00
问题 I am building an Android application which connects with a Bluetooth module. When the application is created, a thread to connect to the module is executed. When i rotate the phone, the application restarts and the connection thread is run again. To get around this, I added android:configChanges="orientation|screenSize" android:windowSoftInputMode="adjustResize|stateHidden" to the Android manifest file. Now the application doesn't get restarted, but a ScrollView I used in the activity does