scrollview issue

Chmava

Member
Licensed User
Longtime User
Hi,

Am i doing something wrong here? It compiler alright but i keep getting error during emulation.

Sub FImages1
FIPanel1.Initialize("fipanel1")
FIPanel1.Width = 100%x
FIPanel1.Height = FIPanel1.Width
FIPanel1.SetBackgroundImage(LoadBitmap(File.DirAssets, "ecf.png"))
Activity.AddView(FIPanel1, 0, 0, 100%x, 100%y)
End Sub

any help highly appreciated!!!
 

klaus

Expert
Licensed User
Longtime User
Try this code:
B4X:
Sub FImages1
  FIPanel1.Initialize("fipanel1")
  Activity.AddView(FIPanel1, 0, 0, 100%x, 100%y)
  FIPanel1.SetBackgroundImage(LoadBitmap(File.DirAss ets, "ecf.png"))
End Sub
You shouldn't set FIPanel1.Width and FIPanel1.Height berfore the view is added to the Activity they are defined in the Activity.AddView method.

Best regards.
 
Upvote 0

Chmava

Member
Licensed User
Longtime User
Try this code:
B4X:
Sub FImages1
  FIPanel1.Initialize("fipanel1")
  Activity.AddView(FIPanel1, 0, 0, 100%x, 100%y)
  FIPanel1.SetBackgroundImage(LoadBitmap(File.DirAss ets, "ecf.png"))
End Sub
You shouldn't set FIPanel1.Width and FIPanel1.Height berfore the view is added to the Activity they are defined in the Activity.AddView method.

Best regards.

OMG! that was the mistake?!?!?!:BangHead:

So sorry to trouble you, now i feel really really stupid to make such a stupid mistake, lol.

Thank you for your help!

Edit: for some weird reason i am receiving a invalid double: "fipanel1"?
 
Last edited:
Upvote 0

Chmava

Member
Licensed User
Longtime User
Did you declare "fipanel1" somewhere else differently ?

Otherwise we need to see your code.

Best regards.

Dim FIPanel1 As ScrollView

that is all i declared.

Edit:

this is all the code in ide and i am still getting the error:

'Activity module
Sub Process_Globals


'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals

'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim FIPanel As ScrollView


End Sub

Sub Activity_Create(FirstTime As Boolean)

FIPanel.Initialize("fipanel")


End Sub



Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Without seeing your other code it's impossible to help you.
The most efficient way is to post your project as a zip file so we could have a look at it and test in the same conditions as you do (IDE menu Files / Export As Zip).
Otherwise we need to try to guess what it could be and play 'ping pong' for a while.

Best regards.
 
Upvote 0

Chmava

Member
Licensed User
Longtime User
Without seeing your other code it's impossible to help you.
The most efficient way is to post your project as a zip file so we could have a look at it and test in the same conditions as you do (IDE menu Files / Export As Zip).
Otherwise we need to try to guess what it could be and play 'ping pong' for a while.

Best regards.

That is probably not it, i create a new one, add in only those code compile successfully, install successfully, when open, it give a double error.

i do not believe this happen with the previous version..........

is there any way to re-download the older one?

edit: ended up using scrollview2d library instead, work 100% no problem. Scrollview is probably bugged in this version (2.20).
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
That is probably not it, i create a new one, add in only those code compile successfully, install successfully, when open, it give a double error.
i create a new one
Can you post this project as a zip file.

it give a double error
What errors ?

i do not believe this happen with the previous version
If you send the project I can try it. I still have the previous versions.

Best regards.
 
Upvote 0

Chmava

Member
Licensed User
Longtime User
i create a new one
Can you post this project as a zip file.

it give a double error
What errors ?

i do not believe this happen with the previous version
If you send the project I can try it. I still have the previous versions.

Best regards.

Attached images test. Appreciate your effort!

Edit: oh and i am testing it on android 4.0.3
 

Attachments

  • images test.zip
    833 bytes · Views: 131
Upvote 0

klaus

Expert
Licensed User
Longtime User
I couldn't test the program in exactly the same conditions as you because you didn't provide the image file in your project and it's the version with ScrollView2D which works for you !?.
So how do you expect we could help.
You didn't even say what errors you get as I requested in my post.

So I modified your program :
- added an image file
- use two ScrollViews, a vertical ScrollView and a ScrollView2D to test both at the same time.

I tested on my devices:
- Nexus One Android 2.3.3
- Asus TF 700 tablet Android 4.0.3

The program works perfectly on both devices with B4A 2.2 !
So ScrollView has NO problems with B4A 2.2 as I expected.

Best regards.
 

Attachments

  • images test1.zip
    34.2 KB · Views: 152
Upvote 0

Chmava

Member
Licensed User
Longtime User
I couldn't test the program in exactly the same conditions as you because you didn't provide the image file in your project and it's the version with ScrollView2D which works for you !?.
So how do you expect we could help.
You didn't even say what errors you get as I requested in my post.

So I modified your program :
- added an image file
- use two ScrollViews, a vertical ScrollView and a ScrollView2D to test both at the same time.

I tested on my devices:
- Nexus One Android 2.3.3
- Asus TF 700 tablet Android 4.0.3

The program works perfectly on both devices with B4A 2.2 !
So ScrollView has NO problems with B4A 2.2 as I expected.

Best regards.

Sorry. i did not know i cause you so much pain.:sign0013:

i cannot provide the image because it's under contract.
also, does a 700KB images 1920px * 4000px++ make any different?
the problem is saying a number issue with double. which is weird cause all are pure int.

so i tested with smaller image and for some miracle, it work, lol.:signOops:

Sorry about all this, but atleast we know scrollview probably cant handle big img file, or android cant handle big file with scrollview?
 
Upvote 0

Chmava

Member
Licensed User
Longtime User
With such an image size, it's probably an Out of Memory error and is not related to ScrollView. A ScrollView can handle very large sizes (up to the maximum value of an integer).

weird thought, it only give out of memory after 2 images in scrollview2d, lol. same resolution and size.
is there no way to tell the system to remove from cache?
i read only you can request the garbage collector to be run thought.
 
Upvote 0

StarinschiAndrei

Active Member
Licensed User
Longtime User
Hi ,

I tried to create a grid with scrollview.
In designer i put a scrollview, than i filled with label. It look nice but is not scrollable. Can anybody tell how can i do it ? thx

Dim nrrand As Int
Dim nrcol As Int
Dim colwidth As Int
Dim rowhight As Int
rowhight=30dip
nrcol=5
colwidth = sv.Width /nrcol
For y=0 To 120
For i=0 To nrcol -1
l.Initialize("test")
l.TextSize =18
l.Text ="rand"&y&"col"&i
sv.Panel.AddView(l,colwidth*i,rowhight*y,colwidth,rowhight)
Next
Next
sv.FullScroll(True)
 
Upvote 0
Top