App launcher in Sketchware with Swift Rein Code: Intent startupIntent = new Intent(Intent.ACTION_MAIN); startupIntent.addCategory(Intent.CATEGORY_LAUNCHER); final android.content.pm.PackageManager pm = getPackageManager(); List<android.content.pm.ResolveInfo> activities = pm.queryIntentActivities(startupIntent,0); Collections.sort(activities, new Comparator<android.content.pm.ResolveInfo>() { 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<android.content.pm.ResolveInfo> adapter = new ArrayAdapter<android.content.pm.ResolveInfo>(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...
Popular posts from this blog
Background video in Sketchware
code: final VideoView vd = new VideoView(MainActivity.this); vd.setLayoutParams(new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.MATCH_PARENT)); vd.setVideoURI(Uri.parse(your video path)); vd.requestFocus(); vd.start(); RelativeLayout rl = new RelativeLayout(this); RelativeLayout rl2 = new RelativeLayout(this); rl2.addView(vd, -1,-1); linear1.removeAllViews(); rl.addView(rl2, -1,-1); rl.addView(linear2, -1,-1); linear1.addView(rl,-1,-1); //this property will all the video to be played in full screen DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); android.widget.RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) vd.getLayoutParams(); params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_TOP, android.widget.RelativeLayout.TRUE); params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_START, android...
Custom notification in Sketchware In extra block: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { CharSequence name = "Channel name 1"; String description = "Notification channel"; int importance = NotificationManager.IMPORTANCE_DEFAULT; NotificationChannel channel = new NotificationChannel("id 1", name, importance); channel.setDescription(description); NotificationManager notificationManager = getSystemService(NotificationManager.class); notificationManager.createNotificationChannel(channel); } In button: RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.cview); Intent intent = new Intent(MainActivity.this, TwoActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0); android.support.v4.app.NotificationCompat.Builder builder = new android.support.v4....

Comments
Post a Comment