orientation-changes

You must call setGraph() before calling getGraph()

会有一股神秘感。 提交于 2020-04-10 04:49:48
问题 I have bottom Navigation also I'm replacing the <fragment> tag with FragmentContainerView it gives me error about does not have a NavController set on, then i was posted this question and fixed the problem, but I got this below error when orientation is changed and selecting item in Bottom Navigation java.lang.IllegalStateException: You must call setGraph() before calling getGraph() FragmentContainer <androidx.fragment.app.FragmentContainerView android:id="@+id/nav_host_fragment" android:name

Recyclerview not populating with data after orientation change

牧云@^-^@ 提交于 2020-01-22 16:23:10
问题 I have a recyclerview having different layouts for portrait and landscape. When the activity starts, the recyclerview populates with data irrespective of the orientation. But if the orientation is changed then no data is shown. And no data is shown on consequent orientation changes. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d("CCC", "OnCreate View called"); View view = inflater.inflate(R.layout.fragment_coach_list, container, false

VideoView & Fullscreen & Orientation changes - Android

让人想犯罪 __ 提交于 2020-01-11 05:08:57
问题 I implemented a e-Reader that has embedded video players on it, I need a option to toggle fullscreen mode from the player. My question is the following: Which is the best way to play a video on fullscreen and let the user come back from this state to the page he is reading before and also keep the current time of the video. Another complicated situation I need to handle is: There's different visualizations of a page on portrait and landscape, if the user toggle fullscreen on portrait and

Keyboard is hidden on orientation change

巧了我就是萌 提交于 2020-01-04 06:48:47
问题 My keyboard is hidden when the orientation of the android phone changes to landscape. What should I do in order to show my keyboard? 回答1: Add this on your code getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); 回答2: getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); put this in onCreate() and onResume() in your class file. 回答3: Hi can you try AndroidManifest.xml android:windowSoftInputMode="stateAlwaysVisible" put

ViewPager with different adapters for portrait and landscape

好久不见. 提交于 2020-01-02 03:29:12
问题 In portrait mode, my ViewPager has 3 fragments A, B, C but in landscape mode, it has only 2 fragments A and C. So I create 2 FragmentStatePagerAdapter s for each mode. The problem is when screen orientation changed, ViewPager restores and uses previous fragments of old orientation. For example, when change orientation from portrait to landscape, ViewPager now shows 2 fragments A, B instead of A and C. I know why this happen but can't find a good solution for this. My current workaround is to

Duplicate permission request after orientation change

和自甴很熟 提交于 2020-01-01 02:33:05
问题 Because the Android SDK 23 gives users the possibility to deny apps access to certain functionalities I wanted to update one of my apps to request permissions as it is described in here: https://developer.android.com/preview/features/runtime-permissions.html. In one of the activities I embed a SupportMapFragment. To make it work you need to have the WRITE_EXTERNAL_STORAGE permission, so I request it when I start the activity which results in a creation of a permission request dialog. Now the

DialogFragment callback on orientation change

☆樱花仙子☆ 提交于 2019-12-31 10:35:35
问题 I'm migrating my dialogs, currently using Activity.showDialog(DIALOG_ID); , to use the DialogFragment system as discussed in the android reference. There's a question that arose during my development when using callbacks to deliver some event back to the activity/fragment that opened the dialog: Here's some example code of a simple dialog: public class DialogTest extends DialogFragment { public interface DialogTestListener { public void onDialogPositiveClick(DialogFragment dialog); } // Use

Backbone - Url's hash becomes empty on orientation change

与世无争的帅哥 提交于 2019-12-25 02:14:16
问题 I'm developing a Phonegap mobile application, using jQuery Mobile, Backbone and RequireJS. I configured jQM to let Backbone manage the routing. Whenever I change the orientation of the device, it seems that the whole layout is being rendered again (the first second or so, I can see just plain text, without the jQM visual enhancements and paging, and this happens when the app starts executing as well) and it goes to the first page, even though another one was being displayed. Did somebody

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

别说谁变了你拦得住时间么 提交于 2019-12-22 08:10:37
问题 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"

Fragment/Activity Lifecycles and Orientation Change

风流意气都作罢 提交于 2019-12-20 10:39:44
问题 Fragments are funny things but, so I thought, once you know their quirks they're an invaluable tool for writing good code across multiple devices. However, while fixing an orientation change bug I've run up against a wall. For my fragment to work it needs access to a View which belongs to it's containing Activity leading me on a merry chase trying to find how the Activity & Fragment lifecycles interact. I'm adding a fragment to my Activities view in it's onCreate() method: // Only add a