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...
T This page will show how to share apk in sketchware project. T 1.Add an button button1 in your sketchware project. 2.In on create activity add an add source directly block 1. In add source directly block paste the code as shown below: StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); if(Build.VERSION.SDK_INT>=24){ try{ java.lang.reflect.Method m = StrictMode.class.getMethod( "disableDeathOnFileUriExposure"); m.invoke(null); } catch(Exception e){ showMessage(e.toString()); } } 3.In more block area create an block share In moreblock add an add source directly block,in add source directly block add the code shown below InIn android.content.pm.ApplicationInfo app = getApplicationContext().getApplicationInfo(); String filePath = app.sourceDir; Intent intent = new Intent(Intent.ACTION_SEND); i...
bhai admin penal me se connection file missing h.
ReplyDelete