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...
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...
Comments
Post a Comment