I am designing Android Application which will upload image files from particular folder in SD card to Google drive. But i am getting
E/AndroidRuntime( 6808): FATAL EXCEPTION: main
E/AndroidRuntime( 6808): java.lang.OutOfMemoryError error while trying to upload the files.
Code snippet:
File sdDir = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File yourDir = new File(sdDir, "CameraAPIDemo");
for (File f : yourDir.listFiles()) {
if (f.isFile()){
String name = f.getName();
Log.i(TAG, "name =" + name);
String CompletePath=yourDir + "/" + name;
//Decode the file from the folder to bitmap
Bitmap bmp = BitmapFactory.decodeFile(CompletePath);
saveFileToDrive(sFolderId,bmp,name);
}
The saveFileToDrive contains logic to upload one file to google drive. How to proceed? Please help me.....