H hasexxl1988 Active Member Licensed User Longtime User May 11, 2017 #1 Hello, I have a problem with the "Youtube Library". (https://www.b4x.com/android/forum/threads/youtube-library.24818) If I leave with the Back Button from the Phone, the Youtubevideo reload my Activity, so everything is reset. Is it possible to bypass the activity which does not reload? The "Activity_KeyPress" does not recognize the backbutton on the Youtube Lib.
Hello, I have a problem with the "Youtube Library". (https://www.b4x.com/android/forum/threads/youtube-library.24818) If I leave with the Back Button from the Phone, the Youtubevideo reload my Activity, so everything is reset. Is it possible to bypass the activity which does not reload? The "Activity_KeyPress" does not recognize the backbutton on the Youtube Lib.
R ronell Well-Known Member Licensed User Longtime User May 12, 2017 #2 what are you trying to achieve? you want to close the app after you press backbutton? edit: i remove the sample code, youtube has its own activity , dont know if there is a way to handle the back keypress in youtube activity Last edited: May 12, 2017 Upvote 0
what are you trying to achieve? you want to close the app after you press backbutton? edit: i remove the sample code, youtube has its own activity , dont know if there is a way to handle the back keypress in youtube activity
Erel B4X founder Staff member Licensed User Longtime User May 12, 2017 #3 You should expect your Activity to be recreated many times. Use StateManager to preserve the UI state. Upvote 0
You should expect your Activity to be recreated many times. Use StateManager to preserve the UI state.
H hasexxl1988 Active Member Licensed User Longtime User May 12, 2017 #4 Erel said: You should expect your Activity to be recreated many times. Use StateManager to preserve the UI state. Click to expand... Can I disable the update of the Activity completely with the StateManager? Edit: If I close the app with the Homebutton of the mobile phone and open it is exactly in the same place as before (there are several panels available, settings etc.). "Activity Resume" is executed. When going back from the Youtubevideo, "Activity Resume" is also executed, but also reset. I do not understand why. Last edited: May 12, 2017 Upvote 0
Erel said: You should expect your Activity to be recreated many times. Use StateManager to preserve the UI state. Click to expand... Can I disable the update of the Activity completely with the StateManager? Edit: If I close the app with the Homebutton of the mobile phone and open it is exactly in the same place as before (there are several panels available, settings etc.). "Activity Resume" is executed. When going back from the Youtubevideo, "Activity Resume" is also executed, but also reset. I do not understand why.
R ronell Well-Known Member Licensed User Longtime User May 12, 2017 #5 why not upload your project as zip Upvote 0
H hasexxl1988 Active Member Licensed User Longtime User May 12, 2017 #6 ronell said: why not upload your project as zip Click to expand... Is a Customer Project with personal Data. I Create a similar Project with the same Function and will Upload it later. Upvote 0
ronell said: why not upload your project as zip Click to expand... Is a Customer Project with personal Data. I Create a similar Project with the same Function and will Upload it later.
H hasexxl1988 Active Member Licensed User Longtime User May 12, 2017 #7 I found the mistake. It is not on the Youtube Lib, but on the adjusted Orientation. When the video is started: p.SetScreenOrientation (0) And when closing the video I have set: p.SetScreenOrientation (1) Thus, after changing the Orientation, the Layout is reloaded but this may not happen ... If I omit the Orientation, the back function of the Youtube Lib works quite normally. EDIT: /close. I have solved it as follows: Code: Copy SetActivityAttribute(Main, android:screenOrientation, "portrait") SetActivityAttribute(Main, android:configChanges, "keyboardHidden|orientation|screenSize") Last edited: May 12, 2017 Upvote 0
I found the mistake. It is not on the Youtube Lib, but on the adjusted Orientation. When the video is started: p.SetScreenOrientation (0) And when closing the video I have set: p.SetScreenOrientation (1) Thus, after changing the Orientation, the Layout is reloaded but this may not happen ... If I omit the Orientation, the back function of the Youtube Lib works quite normally. EDIT: /close. I have solved it as follows: Code: Copy SetActivityAttribute(Main, android:screenOrientation, "portrait") SetActivityAttribute(Main, android:configChanges, "keyboardHidden|orientation|screenSize")