Android Question Problem sending big data (images) trough socket TCP

I have an application what communicates between a PC application (VB6) and android.
everything works fine, and communication between the 2 devices works perfect.
the problem what i have is when i send big data (images) trough TCP, it arrives fine and i can see the images.
but when my device goes to pause, i get an error "java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 804856 bytes"
how can i bypass this?
 
Solution
It is the problem for sure and it is an OS issue. It fails to store the activity state.

This is my last post in this thread as you seem to ignore it. Switch to B4XPages.

DonManfred

Expert
Licensed User
Longtime User
i get an error "java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 804856 bytes"
you are storing the image(s) in a Database? Sounds like a big mistake.

The size of amount of data fetched from a Database can not exceed 1MB
 
Upvote 0
This error is not related to TCP.

1. Post the full error message with the stack trace.
2. Post the relevant code.
Hi Erel,
This is what i got:

** Activity (main) Pause, UserClosed = false **
Sleep not resumed (context is paused): anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub
Sleep not resumed (context is paused): anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1136592 bytes
at android.app.ActivityClient.activityStopped(ActivityClient.java:88)
at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:143)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: android.os.TransactionTooLargeException: data parcel size 1136592 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(BinderProxy.java:662)
at android.app.IActivityClientController$Stub$Proxy.activityStopped(IActivityClientController.java:1309)
at android.app.ActivityClient.activityStopped(ActivityClient.java:85)
... 9 more
 
Upvote 0
you are storing the image(s) in a Database? Sounds like a big mistake.

The size of amount of data fetched from a Database can not exceed 1MB
The images are stored in a MS SQL database on the VB6 Side,
when i connect, i extract the images from the MS SQL DB and convert them into bytes, then i send them through winsock to B4A.
the transfer goes perfectly and quick so that's not the issue i guess, also the image (PNG format) is perfectly shown.

I have worked this weekend to convert everything in one activity in b4a (because i read somewhere transferring big data between activities could cause this error)
but that didn't resolve my issue
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
** Activity (main) Pause, UserClosed = false **
Sleep not resumed (context is paused): anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub
Sleep not resumed (context is paused): anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub
Why are you wasting your time with activities???????
Switch to B4XPages and this error will be resolved.
 
Upvote 0
You might want to consider resizing the images too.

eg if the most-detailed they'll ever be displayed is full-screen on a 2 megapixel smartphone, then there is nothing gained by having an eg 24 megapixel image

especially if you're operating across a mobile connection
the pictures are stored in BMP format (what is huge), so before i transfer them to B4A i convert them to PNG, the size of the picture is arround 90kb's, but the total data can go up to 1 mb
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I have an application what communicates between a PC application (VB6) and android.
everything works fine, and communication between the 2 devices works perfect.
the problem what i have is when i send big data (images) trough TCP, it arrives fine and i can see the images.
but when my device goes to pause, i get an error "java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 804856 bytes"
how can i bypass this?
Don't load the big data which received from PC into ImageView directly
1. Save the data to a image file first.
2. ImageView load data from the file then.
 
Upvote 0

emexes

Expert
Licensed User
the pictures are stored in BMP format

Pictures of what?

If they are photographs, usually JPEG is best.
If they are lines and solid colours, eg diagrams, charts, graphs, cartoons, etc, usually PNG is best.

the size of the picture is arround 90kb's, but the total data can go up to 1 mb

I don't understand this.

Are you sending them as decimal or hexadecimal ASCII or something? With field and line separators and terminators?

However large the .PNG is, your data transfer should be at most maybe 10% larger, not 10x larger.
 
Upvote 0
All right, i did some checking,
It has nothing to do with the length of the text or so on, not even the pictures.
i think it has to do with the amount of views.

My application is huge with views (i preload every button, every label so it runs very quick on older or slower devices)

@Erel can that be the problem? are there limitations? i search on the forum and it says not.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The truth is that I'm not 100% sure that it will solve this issue, but:
1. Good chances that it will.
2. There are many other benefits, especially when dealing with network communication, for B4XPages.
3. If the issue will still exist then we will find a solution.
 
Upvote 0
Top