• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Change picture in Google app

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i am working with google app and java .in my project my present task is change picture in google app.i am writing like this

String url="https://www.google.com/m8/feeds/profiles/domain/"+ sDomain + "/full/pcvita1111qaeteam10?xoauth_requestor_id=appsadmin@soharcoas.com" ;
ContactEntry profile = contactService.getEntry(
new URL(url),
ContactEntry.class);
String filepath="C:\\Users\\bhanuprasad\\Documents\\Downloads\\549002_459129587462191_1689883124_n.jpg";
File file = new File(filepath);
FileInputStream in=new FileInputStream(file);
System.out.println((byte)in.getChannel().size());
byte[] photoData = new byte[(int) file.length()];
System.out.println(photoData);
Link photoLink = profile.getContactPhotoLink();
System.out.println(photoLink);
URL photoUrl = new URL(photoLink.getHref());
System.out.println(photoUrl);



GDataRequest request = contactService.createRequest(GDataRequest.RequestType.UPDATE,
photoUrl, new ContentType("image/*"));

request.setEtag(photoLink.getEtag());
System.out.println(photoLink.getEtag());
OutputStream requestStream = request.getRequestStream();
requestStream.write(photoData);
request.execute();

but i got the follwing exception
com.google.gdata.util.InvalidEntryException: Bad Request
Invalid image file

at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:594)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.cloudcodes.TestOU.main(TestOU.java:137)
Bad Request
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please UseCodeTags when you post next time.

It looks like you create a byte[] named photoData, but never fill it with data. You then try to send that empty byte[] as an image, but because it does not have image bytes in it the request fails. You need to fill photoData with data from a photo.
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bhanuprasad saketi wrote:



Here is your code in tags
 
Bhanuprasad saketi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi thanks for the replay
I have on more doubt in my project i want to wish the user BirthDay's .I am working with google app and java .alreay the user BirthDay date is store in googleapp now i want to compare the date to sysdate if month and date is equal i want to send the BirthDay wishes to user in my database i have 2000 records how to write the code please help me.
 
Bhanuprasad saketi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thanks for the Replay
In my project i upload one image by using <input type='file'> but before uploading the file in google app blob i want to check the image height and wedith means only 98*68 images only i want to upload other than the 98*68 i want to show the error message .how can do this by using javascript or java or jquery ?
 
Bhanuprasad saketi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thanks for the replay in my project i want to show the information in next 7days means if there is any birthday for next 7days i want to show those birthdays .in my project i ma using google app and java .how can i write this code please help me urgent in my project.
 
Bhanuprasad saketi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thanks for the replay..
in my project i want to show the users information into to one csv file i have 2000 records and i am using google app .I red one tutorial we can't write the files in google app so how can i do my task please help me
 
reply
    Bookmark Topic Watch Topic
  • New Topic