【发布时间】:2011-09-06 11:51:44
【问题描述】:
当我尝试从我的 Android 应用程序上传图像或更大的文件时,它会因 OutOfMemoryException 而崩溃。我想知道是否有其他方法可以做到这一点。
我在两个不同的地方遇到了应用程序崩溃:
Base64.encodeToString(bytes, Base64.DEFAULT);
这里 base64 字符串是 nameValuPairs 集合中的值之一。
HttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost(uo.WebServiceURL);
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(nameValuePairs); // On this line
httppost.setEntity(entity);
HttpResponse response = client.execute(httppost);
有什么想法吗?
【问题讨论】: