Good day everyone! I have a question: there is a series of links in the array, which are needed in the background process to load on the phone’s memory (in my cache), while I would like to set the image compression parameters. I will be glad to any help! Thank you very much in advance!

  • What is my cache ? Is it a standard cache or your custom cache? - Barmaley
  • Standard: com.my_pack.my_app, etc. - vanyamelikov

2 answers 2

Something like this:

Bitmap bitmap; // ссылка на существующий битмап Context context; //ссылка на контекст приложения //открываем файл в приватном каталоге нашей аппы OutputStream stream = context.openFileOutput("test.png", MODE_WORLD_WRITEABLE); bitmap.compress(CompressFormat.PNG, 70, stream);// пишем битмап на PNG с качеством 70% stream.close(); 

    Well, respectively, if you have an array of links, then all of the above steps need to be done in a loop.
    This is a standard task, which is google in 2 minutes.

    • @Andreich is all clear, but the essence of the question is how to save the image to the memory of the phone (in the cache) while resizing the image. - vanyamelikov
    • so what's stopping you first resize a bitmap and then save it - andreich
    • I tried all three of your examples and a few more! None of them work properly! I just need to just save the karinka by reference ( ofs.ft-ru.ru/storage/catalogs ... ) to the phone's memory in the application folder! - vanyamelikov