Sketchware: How to download and auto display images in gallery || Fix downloaded images not showing

INFINITIFICATION
INFINITIFICATION
787 بار بازدید - 4 سال پیش - Source code;DOWNLOAD;Bitmap returnedBitmap = Bitmap.createBitmap(_view.getWidth(),
Source code;

DOWNLOAD;

Bitmap returnedBitmap = Bitmap.createBitmap(_view.getWidth(), _view.getHeight(),Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(returnedBitmap); android.graphics.drawable.Drawable bgDrawable=_view.getBackground();
if (bgDrawable!=null) { bgDrawable.draw(canvas);
} else {  } _view.draw(canvas); java.io.File pictureFile = new java.io.File(Environment.getExternalStorageDirectory() + "/Pictures/image.PNG");
java.io.File filename = new
java.io.File (Environment.getExternalStorageDirectory() + "/Pictures/"+ _name);
pictureFile.renameTo(filename);
if (pictureFile == null) { showMessage("Error creating media file, check storage permissions: "); return;
} try { java.io.FileOutputStream fos = new java.io.FileOutputStream(pictureFile); returnedBitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.close();
showMessage("Image Saved successfully"); } catch (java.io.FileNotFoundException e) { showMessage("File not found: " + e.getMessage());
} catch (java.io.IOException e) { showMessage("Error accessing file: " + e.getMessage()); }


MEDIASCANNER;

MediaScannerConnection.scanFile(this, new String[] { filename.getAbsolutePath()}, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { } });


You can ask questions if you could not get it right

Song: Jarico - Island
Music supported by #BackgroundMusicWithoutLimitations
Watch: Free Background Music For Youtube Vid...
Free Download: https://bit.ly/3n3snwj
4 سال پیش در تاریخ 1399/10/26 منتشر شده است.
787 بـار بازدید شده
... بیشتر