Android Question ZoomImageView and Android 16

blong

Active Member
Licensed User
Longtime User
I downloaded and tried the B4A example which is a simple map of the world. I am using Android 16 phone, with SDK set at 33 however the simple app crashes with an

java.lang.ClassCastException: Couldn't convert result of type java.lang.Boolean to java.lang.String

the moment I try to pinch the image..

Any help appreciated.
 

blong

Active Member
Licensed User
Longtime User
Yes just ran the example without any changes. The world map appears but the moment I try and pinch the image it crashes. Running in debug mode.
Error messages of crash:
    Logger connected to:  OPPO CPH2499
--------- beginning of main
Copying updated assets files (2)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
java.lang.ClassCastException: Couldn't convert result of type java.lang.Boolean to java.lang.String
    at $Proxy5.toString(Unknown Source)
    at java.lang.String.valueOf(String.java:4523)
    at java.lang.StringBuilder.append(StringBuilder.java:183)
    at android.view.View.performOnTouchCallback(View.java:16867)
    at android.view.View.dispatchTouchEvent(View.java:16787)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3217)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2877)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:569)
    at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:2098)
    at android.app.Activity.dispatchTouchEvent(Activity.java:4768)
    at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:517)
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
I did get a warning message when first installing app that it was designed in an earlier version of Android... if this is relevant.
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
Full simple coded example
ZoomImageView sample:
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region

'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=ZoomIVExample.zip

Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private ZoomImageView1 As ZoomImageView
End Sub

Public Sub Initialize
    
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    ZoomImageView1.SetBitmap(xui.LoadBitmap(File.DirAssets, "Wkipedia_blank_world_map.jpg"))
End Sub

Private Sub ZoomImageView1_Click
    Log("Click")
End Sub
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
Did as requested. Added JavaObject and cleaned project still crashed.

Crash details:
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
java.lang.ClassCastException: Couldn't convert result of type java.lang.Boolean to java.lang.String
    at $Proxy5.toString(Unknown Source)
    at java.lang.String.valueOf(String.java:4523)
    at java.lang.StringBuilder.append(StringBuilder.java:183)
    at android.view.View.performOnTouchCallback(View.java:16867)
    at android.view.View.dispatchTouchEvent(View.java:16787)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3217)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2877)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3223)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2834)
    at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:569)
    at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:2098)
    at android.app.Activity.dispatchTouchEvent(Activity.java:4768)
    at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:517)
    at android.view.View.dispatchPointerEvent(View.java:17197)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:9288)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:8957)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:8321)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:8385)
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
Is it possible to use a different version of SDK ? I have another device, which is older and runs Android 10. ZoomImageView does not crash, but the pinch in/out seems to only zoom IN, the out gesture zooms in as well. Performance is jerky and non-ideal. Obviously, Android Photos works beautifully compared to ZoomImageView.
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
Yes now have as internal library and it shows as 2.07

AND it works .... Big Thank you .... will test on other devices tomorrow.

:cool:
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
Tested the sample app on my old Android 10 device and it works perfectly using the JavaObject 2.07 library. The zoom in/out and the pan are very smooth, just like Android photos.

So I went back to my messaging app that I am developing where I have a CustomListView to show messages. When user wants to add an image I pop up a MediaChooser and get an image from my phone and place this in a ZoomImageView, which is inside a panel that pops up over the CLV and takes up, say, half the screen. When I try to pinch on the ZoomImageView it "sort of works" in that it zooms in (enlarges image) and pans OK, but neither is smooth. Because the CLV is still partly visible on screen, I can touch the visible part of the CLV and slide it up and down.

I feel the ZoomImageView pinch in/out movements are being partly passed to the CLV ... or something like that... It will not zoom out (reduce image size) at all.

Would there be a conflict between ZoomImageView and CLV sitting behind it ???

Should I hide the CLV? or make the panel full screen so that the CLV is not even partly visible? Or even open a new B4Xpage and review my image there, where no CLV is even present?
 
Upvote 0
Top