The post guide how to download any file from file url in sketchware project. 1.Add a linear layout linear1 and a button button1 which will act as download block [Download file FROM URL(string: url) TO PATH(string: path) with progress dialog] 2.In moreblock area create a moreblock Download. In add source directly block add following code: 3. android.net.ConnectivityManager connMgr = (android.net.ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); android.net.NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) { final String urlDownload = _url; DownloadManager.Request request = new DownloadManager.Request(Uri.parse(urlDownload)); final String fileName = URLUtil.guessFileName(urlDownload, null, null); request.setDescription("URL - " + urlDownload); request.setTitle(fileName); request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIF...
The tutorial is how to save an image to gallary from imageview in sketchware. Create a new project,add an imageview imageview1,two buttons button1 and button 2.Change weidth and height of imageview1 as match_parent and 500 dp. In logic area create a more block 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 { canvas.drawColor(Color.WHITE); } _view.draw(canvas); java.io.File pictureFile = new java.io.File(Environment.getExternalStorageDirectory() + "/Download/image.png"); 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(); showMess...
bhai admin penal me se connection file missing h.
ReplyDelete