10 Sketchware premium Free Codes for your Sketchware project

Sketchware Codes,sketchware latest working cool codes for your sketchware project.Sketchware codes are helpful because they help you to complete your sketchware projects in time.sketchware is one of the best app builder that lets you create fantastic apps in a little time. unlike App pie Sketchware gives you a simple ui and understandable features.sketchware was rated in the top 20 cool app builders that are cool and fast.with it's cool features sketchware allows you to add admob . Sketchware 2022 version has high features although it's a mod it's super cool. These sketchware Codes were taken from SketchJava and their rightful owners we give credits to those who owns this kind of work.

 Battery - Battery level


BatteryManager bm = (BatteryManager)getSystemService(BATTERY_SERVICE);
int batLevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
textview1.setText(Integer.toString(batLevel));

 Clipboard - Get Text


ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); 
yourwidget.setText(clipboard.getText());

 Graphics - layer drawable

// Initialize some new ColorDrawable objects
android.graphics.drawable.ColorDrawable leftBorder = new android.graphics.drawable.ColorDrawable(Color.RED);
android.graphics.drawable.ColorDrawable topBorder = new android.graphics.drawable.ColorDrawable(Color.GREEN);
android.graphics.drawable.ColorDrawable rightBorder = new android.graphics.drawable.ColorDrawable(Color.BLUE);
android.graphics.drawable.ColorDrawable bottomBorder = new android.graphics.drawable.ColorDrawable(Color.YELLOW);
android.graphics.drawable.ColorDrawable background = new android.graphics.drawable.ColorDrawable(Color.WHITE);

 // Initialize an array of Drawable objects
android.graphics.drawable.Drawable[] layers = new android.graphics.drawable.Drawable[]{
          leftBorder, // Red color
          topBorder, // Green color
          rightBorder, // Blue color
          bottomBorder, // Yellow color
          background // White background
};

// Initialize a new LayerDrawable
android.graphics.drawable.LayerDrawable layerDrawable = new android.graphics.drawable.LayerDrawable(layers);

// Red layer padding, draw left border
layerDrawable.setLayerInset(0,0,0,15,0);

// Green layer padding, draw top border
layerDrawable.setLayerInset(1,15,0,0,15);

// Blue layer padding, draw right border
layerDrawable.setLayerInset(2,15,15,0,0);

// Yellow layer padding, draw bottom border
layerDrawable.setLayerInset(3,15,15,15,0);

// White layer, draw the background
layerDrawable.setLayerInset(4,15,15,15,15);

textview1.setBackground(layerDrawable);
textview1.setPadding(25,25,25,25);

Keyboard - hidden keyboard


android.view.View view = this.getCurrentFocus();   android.view.inputmethod.InputMethodManager imm = (android.view.inputmethod.InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0);

Manager - file size


public String getFileSizes(long size) {
if(size <= 0) return "0";
final String[] units = new String[] { "B", "KB", "MB", "GB", "TB", "PB", "EB" };
int digitGroups = (int) (Math.log10(size)/Math.log10(1024));
String result = null;
result = new DecimalFormat("#,##0.#").format(size/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
return result;
}

Runtime - Free memory


Runtime SData = Runtime.getRuntime();
firstStorage = SData.freeMemory(); 
SData.gc();
afterStorage = SData.freeMemory();

System - get ip


//Check the internet connection.
@SuppressWarnings("deprecation")
private void NetwordDetect() {
    boolean WIFI = false;
    boolean MOBILE = false;
    android.net.ConnectivityManager CM = (android.net.ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    android.net.NetworkInfo[] networkInfo = CM.getAllNetworkInfo();
    for (android.net.NetworkInfo netInfo : networkInfo) {
          if (netInfo.getTypeName().equalsIgnoreCase("WIFI")) {
              if (netInfo.isConnected()) {
                  WIFI = true;
              }
          }
          if (netInfo.getTypeName().equalsIgnoreCase("MOBILE")) {
              if (netInfo.isConnected()) {
                  MOBILE = true;
              }
          }
    }
    if(WIFI == true) {
       final String IPaddress = GetDeviceipWiFiData();
       textview1.setText(IPaddress);
   }
   if(MOBILE == true) {
      final String IPaddress = GetDeviceipMobileData();
      textview1.setText(IPaddress); 
  } 
}
 
public String GetDeviceipMobileData(){
 try {
       for (Enumeration<java.net.NetworkInterface> en = java.net.NetworkInterface.getNetworkInterfaces(); 
             en.hasMoreElements();) {
             java.net.NetworkInterface networkinterface = en.nextElement();
          for (Enumeration<java.net.InetAddress> enumIpAddr = networkinterface.getInetAddresses(); enumIpAddr.hasMoreElements();) {
             java.net.InetAddress inetAddress = enumIpAddr.nextElement();
             if (!inetAddress.isLoopbackAddress()) {
                 return inetAddress.getHostAddress().toString();
            }
         }
      }
 } catch (Exception ex) {
      textview1.setText("Current IP" + ex.toString());
 }
 return null;
}
 
public String GetDeviceipWiFiData() {
 android.net.wifi.WifiManager wm = (android.net.wifi.WifiManager) getSystemService(WIFI_SERVICE);
 @SuppressWarnings("deprecation")
 String ip = android.text.format.Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());
 return ip;
}


//Add Permission to manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>


//On Button Access
NetwordDetect();

 Tools - auto generate Id


//Generate ID
private static final java.util.concurrent.atomic.AtomicInteger sNextGeneratedId = new java.util.concurrent.atomic.AtomicInteger(1);
public static int generateViewId() {
    for (;;) {
        final int result = sNextGeneratedId.get();
        // aapt-generated IDs have the high byte nonzero; clamp to the range under that.
        int newValue = result + 1;
        if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0.
        if (sNextGeneratedId.compareAndSet(result, newValue)) {
            return result;
        }
    }
}

//use
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
myView.setId(Utils.generateViewId());
} else {
myView.setId(View.generateViewId());
}

 Tools - get package


public class _getPackageName {
private String _package = "";
public String _get() {
_getPackageName _o = new _getPackageName();
Package _pack = _o.getClass().getPackage();
String _packageName = _pack.getName();
return _package = _packageName;
}
public String _getPackage() {
if (_package.equals("")) {
_get();
return _package;
} else {
return _package;
}
}
}

Tools - share APK


String apk = "";
String uri = ("com.my.project");

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"));

Comments

You may like

How to fix resume and Reset in PPSSPP APK and games

How to fix feature not available in Android 10.

How to add Music in Sports Cars 3: taxi and police

OpenVPN latest Settings for Netone (unlimited internet)

The Godfather (2006) - Free Download Full Version

Unleashing the Power: Why Gamers Swear by Android for Extreme Gaming

Finchvpn latest settings for Netone (free internet settings for netone)

Troubleshooting Guide: Resolving USB OTG Issues on Android Devices

Readyboost in windows:how to use usb as virtual ram and boost your computer

Latest DroidVPN Settings for Econet (Free unlimited internet hack)