Android Question Sliding Drawer unresponsive after a screen snapshot with B4XView?

My App uses the sliding drawer as per AppCompat and a Screen snapshot - all works exactly as expected with the sliding drawer, until I do a PrtSc (activity snapshot). The items on the sliding drawer then fail to respond for a period - I cant decide if it is for a time (propbably not) or until I slide the draw in an out/press on the hamburger or do a long press, but after some time they become responsive again - any ideas - I tried a sleep(0) before the PrtSc to no avail.
The PrtSc routine is:
B4X:
Sub PrtSc_Click
    'capture screenshot
    Dim download As String = File.DirRootExternal & "/Download/"
    DateTime.DateFormat = "yyyyMMdd-HHmmss"
    Dim x As B4XView = Activity 'XUI library
    Dim bmp As Bitmap = x.Snapshot
    Dim out As OutputStream = File.OpenOutput(download, DateTime.Date(DateTime.Now) & ".jpg", False)
    bmp.WriteToStream(out, 80, "JPEG")
    out.Close
    ToastMessageShow("Snapshot in Download folder",True)
and the sliding drawer:
B4X:
Sub Globals
    Private ACToolBarLight1 As ACToolBarLight
    Private ToolbarHelper As ACActionBar
    Private Drawer As B4XDrawer
    Private ListView1 As ListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Drawer.Initialize(Me, "Drawer", Activity, 300dip)
    Drawer.CenterPanel.LoadLayout("1")
    ToolbarHelper.Initialize
    ToolbarHelper.ShowUpIndicator = True 'set to true to show the up arrow
    Dim bd As BitmapDrawable
    bd.Initialize(LoadBitmap(File.DirAssets, "hamburger.png"))
    ToolbarHelper.UpIndicatorDrawable =  bd
    ACToolBarLight1.InitMenuListener
    Drawer.LeftPanel.LoadLayout("Left")
    For i = 1 To 10
        ListView1.AddSingleLine("Line " & i)
    Next
    
    Dim b As Button
    b.Initialize("PrtSc")
    b.Text = "PrtSc"
    ACToolBarLight1.AddView(b, 60dip, 40dip, Gravity.RIGHT)

End Sub
What am I doing wrong/leaving out? I tested with a modified AppCompat attached.
 

Attachments

  • AppCompat.zip
    11.6 KB · Views: 40

Peter Simpson

Expert
Licensed User
It's all working here. Run the app, take a snapshot (or multiple snapshots), then go to the menu and select items, they responds instantly in both Debug and release modes. I can do this all day with absolutely no issues or delay in your app. I can go from snapshots to clicking on menu items time after time after time with no issues, everything is responding as expected.

Tested on both Pixel 4 XL and 5 XL devices.

Are you using the newest libraries available/B4A 10.70?
 
Upvote 0
Thank you for your testing - yes mine works fine when tested on a Moto G5s running Android 8.1 but the problem is with my Xiaomi Mi 9T Pro running Android 10 with MIUI 12.04. I have found that if I jiggle the drawer back and forth responsiveness returns! I found other aspects of my App which worked on Oreo need tweaking on Q10 (eg. Bluetooth needs permission for PERMISSION_ACCESS_FINE_LOCATION, not just COARSE as on Oreo - Off topic, I know). B4A 10.70, libraries all the same version as online, specifically B4XDrawer 1.55, XUI 2.10. You have a Pixel 5XL - do you mean 5S? What Android version - 11?
PS. there is a funny midge stuck inside my screen (thought I was back in Malawi) 😇, and B4A is quite wonderful 😍
 
Upvote 0

Peter Simpson

Expert
Licensed User
Thank you for your testing - yes mine works fine when tested on a Moto G5s running Android 8.1 but the problem is with my Xiaomi Mi 9T Pro running Android 10 with MIUI 12.04.
Both my devices are running Android 11 with absolute no issues whatsoever. I would expect our to run shortly on a Moto 5G, but I've had huge problems with cheaper Huawei and Xiaomi devices in the past.

Did you test your code on the Xiaomi in release mode?

Sorry not Pixel 5 XL (which does not exist) I meant to say Pixel 5.
 
Last edited:
Upvote 0
Thanks - yes the "issue" exists in both debug and release mode - More experimenting shows that after a PrtSc, the drawer will only respond if I jiggle it back and forth. Maybe it is a Xiaomi "feature" then. NOT(Sinophobe) = TRUE!
 
Upvote 0
Top