orientation-changes

How to retain selected item of Recycler view on changing screen orientation android?

纵饮孤独 提交于 2019-12-10 19:16:01
问题 I want to retain the state of the RecyclerView's selected item whenever the screen orientation changes, but whenever I change the orientation, the selected item does not retain its state. So I save the position of the selected item and on orientation change in onResume() . I get the position and by using the RecyclerView's getChildAt() method I try to get the View of that item, but it returns null. I am in serious troubles, please help. @Override protected void onCreate(Bundle

Fragment's onActivityResult not called after orientation change

ぐ巨炮叔叔 提交于 2019-12-09 05:47:50
问题 Please note, this question is not a duplicate of the following: https://stackoverflow.com/questions/19006776/onactivityresult-not-working-with-fragments onActivityResult not working on fragments Also, another similar question was asked before, but that doesn't mention orientation changes (and is unresolved). My onActivityResult method in the Fragment does get called if I don't switch orientation. However, if I follow these steps, it doesn't get called: Load fragment in FragmentActivity. From

what's wrong with my sensor monitoring technique?

こ雲淡風輕ζ 提交于 2019-12-09 04:48:41
问题 (please read UPDATE 3 at the end)I'm developing an app that continually works with the sensors of device, works with Accelerometer and Magnetic sensors to retrieve the orientation of device(the purpose is mentioned here). in other words, my app needs to know the orientation of device in Real-time(however this is never possible, so as fast as possible instead, but really as fast as possible !). as mentioned in professional Android 4 Application Development by Reto Meier : The accelerometers

Custom image view looses state on Marshmallow

走远了吗. 提交于 2019-12-08 10:44:37
问题 I am using the PhotoView library in my Android project. The project contains the SaveStatePhotoView which is used to keep the state (zoom level, position) of the image view on configuration changes (rotation, ...). // SaveStatePhotoView.java @Override protected void onRestoreInstanceState(Parcelable state) { if (!(state instanceof SavedState)) { super.onRestoreInstanceState(state); return; } final SavedState ss = (SavedState) state; super.onRestoreInstanceState(ss.getSuperState());

SwitchCompat OnCheckedChangeListener called on every orientation change of Fragment

半城伤御伤魂 提交于 2019-12-08 09:02:01
问题 I have an activity which hosts a fragment and the problem is that, on every orientation change and only if the switch was in the checked state, the OnCheckedChangeListener is called. How do I solve this problem? Thanks! MainActivity.java: public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); if (savedInstanceState == null) { getSupportFragmentManager()

While using appium how can we change device orientation to landscape mode?

Deadly 提交于 2019-12-07 18:45:35
问题 While using appium to test mobile application coded in Angular JS with protractor how can we change simulator orientation to landscape mode? I have added : 'deviceorientation': 'landscape', in config.js file. But it didn't change when i run it. 回答1: I solve it with uppercase in capabilities in the config file : 'orientation': 'LANDSCAPE' also with this option it is working : 'deviceorientation': 'LANDSCAPE' 回答2: Using server capabilities : orientation - ( Sim/Emu-only ) start in a certain

What is the proper way to handle image rotations for iphone/ipad?

我的梦境 提交于 2019-12-07 16:38:23
问题 I have 2 images, one in portrait mode, and the other in landscape mode. What is the best way to switch these images when a mobile device view rotation takes place? Currently I just display the portrait image. And when the device rotates to landscape mode the portrait image is simply stretched. Should I be checking within the orientation rotation handler and simply reset the image to the proper orientational image (i.e. set it manually based on the orientation)?? Thanks! 回答1: I found three

What is the proper way to handle image rotations for iphone/ipad?

孤街醉人 提交于 2019-12-06 01:51:20
I have 2 images, one in portrait mode, and the other in landscape mode. What is the best way to switch these images when a mobile device view rotation takes place? Currently I just display the portrait image. And when the device rotates to landscape mode the portrait image is simply stretched. Should I be checking within the orientation rotation handler and simply reset the image to the proper orientational image (i.e. set it manually based on the orientation)?? Thanks! Shamsudheen TK I found three ways.I think the last one is better 1: Autoresizing Example: UIImageView *myImageView=[

Switching orientation error: Fragment Error - Duplicate id, tag, or parent id 0x0

北战南征 提交于 2019-12-05 14:37:15
I have a Fragment SearchPageFragment (representing the main view on a tablet) which itself contains two fragments inside of it: <fragment android:name="com.test.fragments.SearchFormFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="2dp" android:id="@+id/searchFormFragment" android:tag="searchFormFragmentTag"> <!-- Preview: layout=@layout/fragment_search_form --> </fragment> <fragment android:name="com.test.fragments.SearchResultsFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id

App size is too big because of too many images

谁说胖子不能爱 提交于 2019-12-05 01:30:57
问题 I'm creating an universal app. For one screen, I'm displaying 6 images (png format) in a grid using this control. Also this screen supports both portrait and landscape orientation. I've created a set of images in different resolutions for all the iDevices and named them using the correct naming convention as follows. name~iphone.png name@2x~iphone.png name~ipad.png name@2x~ipad.png name-568h@2x~iphone.png (iPhone 5) And I had to create another set of these images since I support both