Does not work either:
----------------------------------------------------------------------------------------
public void getFileFromInternet(String tempUrl) {
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(tempUrl);
try {
HttpResponse response = httpClient.execute(httpGet);
response = httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
Long lastacc = System.currentTimeMillis();
String fileName = "cashed_" + Long.toString(lastacc)
+ ".tmp";
File myNewFile = new File(fileName);
InputStream inputStream = entity.getContent();
FileOutputStream out =
context.openFileOutput(myNewFile.getName(),
Context.MODE_WORLD_WRITEABLE);
byte buf[] = new byte[1024];
int len;
while ((len = inputStream.read(buf)) > 0)
out.write(buf, 0, len);
out.close();
inputStream.close();
Log.d("TTTTTTTTTEEEEEEEESSSSSSSSSSTTTTTTTTTT",
Long.toString(new
File(fileName).length())); // also 0
} catch (Exception e) {
e.printStackTrace();
}
httpClient.getConnectionManager().shutdown();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---