Posts

Showing posts with the label code

App List Launcher With Sketchware

Image
Code Used : Intent startupIntent = new Intent(Intent.ACTION_MAIN); startupIntent.addCategory(Intent.CATEGORY_LAUNCHER); final android.content.pm.PackageManager pm = getPackageManager(); List activities = pm.queryIntentActivities(startupIntent,0); Collections.sort(activities, new Comparator() { public int compare(android.content.pm.ResolveInfo a, android.content.pm.ResolveInfo b) { android.content.pm.PackageManager pm = getPackageManager(); return String.CASE_INSENSITIVE_ORDER.compare( a.loadLabel(pm).toString(), b.loadLabel(pm).toString()); } }); ArrayAdapter adapter = new ArrayAdapter( this, android.R.layout.simple_list_item_1, activities) { public View getView(int pos, View convertView, ViewGroup parent) { TextView tv = new TextView(MainActivity.this); android.content.pm.ResolveInfo ri = getItem(pos); tv.setText(ri.loadLabel(pm)); LinearLayout lin = new LinearLayout(MainActivity.this);ImageView iv = new ImageView(MainActivity.this);iv.setImageDrawable(ri.loadIcon(pm));lin.addView(iv)...

Change wallpaper Programmatically Sketchware

Image
Code used : WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext()); try { Bitmap bitmap = ((android.graphics.drawable.BitmapDrawable) imageview1.getDrawable()).getBitmap(); myWallpaperManager.setBitmap(bitmap); } catch (Exception g) { g.printStackTrace(); } Add this to your manifest.xml <uses-permission android:name="android.permission.SET_WALLPAPER"/> Video tutorial :

Build basic browser with Sketchware [part #1]

Image
All codes used in my tutorial Enable Enable Download : webview1.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); Progress Bar : final android.widget.ProgressBar prog = new android.widget.ProgressBar(this,null, android.R.attr.progressBarStyleHorizontal); prog.setPadding(0,0,0,0); prog.setIndeterminate(false); prog.setFitsSystemWindows(true); prog.setProgress(0); prog.setScrollBarStyle(android.widget.ProgressBar.SCROLLBARS_OUTSIDE_INSET); prog.setMax(100); ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); prog.setLayoutParams(vlp); pl.addView(prog); webview1.setWebChromeClient(new WebChromeClient() { @Override public void onProg...

Share functionality to your app [Sketchware /Code]

Image
Code Used : String apk = ""; String uri = (getPackageName()); try { android.content.pm.PackageInfo pi = getPackageManager().getPackageInfo(uri, android.content.pm.PackageManager.GET_ACTIVITIES); apk = pi.applicationInfo.publicSourceDir; } catch (Exception e) { showMessage(e.toString()); } Intent iten = new Intent(Intent.ACTION_SEND); iten.setType("*/*"); iten.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new java.io.File(apk))); startActivity(Intent.createChooser(iten, "Send APK")); Video tutorial :

Turn on /off WiFi sketchware

Image
Hello Amigos, i hope you are doing well Sorry for the late, Like, share and subscribe for more videos  Code used : final android.net.wifi.WifiManager wifi = (android.net.wifi.WifiManager)getSystemService(Context.WIFI_SERVICE); if (wifi.isWifiEnabled()) { wifi.setWifiEnabled(false); showMessage("Wifi Disable"); } else { wifi.setWifiEnabled(true); showMessage("Wifi Enable"); } // add permission <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />