Android Question How to save large size file?

Suvetha

Member
Hii all,
1. It is possible to save large size file, When I save 20MB size file Out Of Memory error occur while encrypt using AES_Encrypt Function. How to overcome this error?

2. How to convert Bytes to File without using Filename and Dir. For example, I save 10MB pdf file means I convert File to Bytes using Filename and Dir and save bytea field in postgres. The file saved in database like (BLOB) 10MB. Now how to convert Bytes to File without using Filename and Dir.

Thanks
Suvetha
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
You have been over two days waiting for a response so I will have a go as nobody else seems willing to try. I have never used AES encryption or a database Blob but I will do my best.

1. It is possible to save large size file, When I save 20MB size file Out Of Memory error occur
I wouldn't call 20MB a particularly large file, and since your device has many gigabytes of memory it is difficult to imagine that it has run out of space. It is far more likely that there is an error in your coding but it is hard to be more specific when you don't show us either your code or your error message.

2. How to convert Bytes to File without using Filename and Dir.
When you save data in a Blob you are saving an array of bytes. When you retrieve the Blob you get back an array of bytes. You have got a problem with your "mental model" I think. If the data represented an image then you could load it into an ImageView. But it sounds as though this data represents a PDF, so I would expect that you would want to convert it back to a PDF. If not, what do you want to do with it?

A final suggestion - don't ask two different questions in a single post. It would be better to start again with two separate threads. And show some code.
 
Upvote 0
Top