• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Image must be valid base64 format and file type must be .jpg format error

 
Ranch Hand
Posts: 36
Android Java ME
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted this question earlier today on StackOverflow,but without answer ,and need this to be solved tonight, that's why am also posting it here...so sorry for cross posting but i am desperate :\

so basically when i try to send string to server i am getting this error.I am trying to send image ,as string, with SharedPreferences from fragment to viewModel and then send it with other data that server expect

my fragment code:

and in my view model i reciving and seting this image this wey:
 
Master Rancher
Posts: 4251
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i am getting this error.


Can you copy the stacktrace from the logcat and paste it here so we can see the full error?
 
Milos Gojic
Ranch Hand
Posts: 36
Android Java ME
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:

i am getting this error.


Can you copy the stacktrace from the logcat and paste it here so we can see the full error?


my app doesn't crash i am getting ths error in my debugger

 
Norm Radder
Master Rancher
Posts: 4251
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

my app doesn't crash


What happens when you execute the app?
 
Milos Gojic
Ranch Hand
Posts: 36
Android Java ME
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:

my app doesn't crash


What happens when you execute the app?



Simply won't update to server. If i go to debug then i see 400 bad request and in error body i got that error, but my app doesn't crash simply wont do what is supposed to do..
 
Norm Radder
Master Rancher
Posts: 4251
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

 won't update to server


What server are you talking about?  What protocol are you using to send the String to the server?

Why do you have to use the debugger to see the error message?  Can the code receive/extract the message and print it on the logcat?
 
Milos Gojic
Ranch Hand
Posts: 36
Android Java ME
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:

 won't update to server


What server are you talking about?  What protocol are you using to send the String to the server?

Why do you have to use the debugger to see the error message?  Can the code receive/extract the message and print it on the logcat?


I am using retrofit and okhttp...and sung a HashMap to send all data to the server..  but what is weird is that i got some base64

but getting that error
 
Norm Radder
Master Rancher
Posts: 4251
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I do not know anything about how those packages work.
 
Marshal
Posts: 3457
493
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like the Base64 encoded representation of image got corrupted somehow.

The image metadata indicates a type of jpeg with a resolution of 720×1560 and an image file size of 2.92 kB.  There are 3987 characters in the Base64 encoding, which translates to 2990 unencoded bytes, which does match the size indicated in the header.

When I tried to view it, you can tell it is a screen cap from an Android handset, but it only partially rendered:

 
expectation is the root of all heartache - shakespeare. tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic