Good day. There is a question how to save the existing Bitmap in the phone's cache, and then have easy access to this file, within one application.
Download the picture in this way:
@Override protected Bitmap doInBackground(Void... params) { try { URL urlConnection = new URL(url); HttpURLConnection connection = (HttpURLConnection) urlConnection .openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap myBitmap = BitmapFactory.decodeStream(input); return myBitmap; } catch (Exception e) { e.printStackTrace(); } return null; }
Then use for their own purposes. But how to save and use it in the future, without having access to the network?