I have read Yaniv Inbar's Picasa (xml-based) android client, and the 
similar google Docs client, and both work well for me to both upload and 
view files.  I want to know how to download.  I am trying to download via 
the authorized url, like this, but instead of the file expect, it returns 
me a "Welcome to Google Docs" page when I download it via HTTP connect and 
reads.  If I paste that url, however, into a browser, it properly downloads 
the file I wanted.  Help?
 
https://docs.google.com/document/d/<<oauth token goes 
here>>/export?format=txt
URL url = 
new URL(preUrl); 
URLConnection connection = url.openConnection(); 
connection.connect(); 
// this will be useful so that you can show a typical 0-100% progress bar 
int fileLength = connection.getContentLength(); 
dialog.setMax(100); 
// download the file InputStream input = 
new BufferedInputStream(url.openStream()); 
String tempFileName = 
mFileName + ImportRequest.mTempFileNameExtension + ".txt"; 
OutputStream output = 
new FileOutputStream("/sdcard/downloads/" + tempFileName); 
byte data[] = new byte[1024]; 
long total = 0; 
int count; 
while ((count = input.read(data)) != -1) { 
total += count; 
... and so on

 

 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to