Posts

Make an advanced text editor in sketchware

Image
PLEASE SUBSCRIBE Click here to subscribe... Code :- Collections.sort(string_files, String.CASE_INSENSITIVE_ORDER); Collections.sort(newVv, String.CASE_INSENSITIVE_ORDER); Collections.sort(hiddenOnes, String.CASE_INSENSITIVE_ORDER); Thank you

Toast a message with a custom view in sketchware

1) Create a new Sketchware Project. 2) Add a new Custom view with name custom . 3) Add a more block customToast with a String text . 4) In that Moreblock add a ASD block and copy the below code:- LayoutInflater inflater = getLayoutInflater(); View toastLayout = inflater.inflate(R.layout.custom, null); TextView textview = (TextView) toastLayout.findViewById(R.id.textview1); textview.setText(_text); LinearLayout linear = (LinearLayout) toastLayout.findViewById(R.id.linear1); Toast toast = new Toast(getApplicationContext()); toast.setDuration(Toast.LENGTH_SHORT); toast.setView(toastLayout); toast.show(); 5) Go to the custom view then add a Linear Layout linear1 and a TextView textview1 inside it. 6) By using this moreblock customToast you can show custom toast. Thank You... In order to make the custom toast rounded replace the above code with this code:- LayoutInflater inflater = getLayoutInflater(); View toastLayout = inflater.inflate(R.layout.custom, null); TextView textview = (TextView...

Menu with icon in actionbar in sketchware

Image
1) Create a sketchware project. 2) Add a more block extra. 3) In that more block  extra  do as below:- 4) Code used in First ASD block is:- } @Override public boolean onCreateOptionsMenu (Menu menu){ menu.add(0,0,0,"Settings").setIcon(R.drawable.settings) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0,1,1,"Profile"); menu.add(0,2,2,"About"); menu.add(0,3,3,"Rate now"); return true; 5) Code used in Second ASD block is:- } @Override public boolean onOptionsItemSelected(MenuItem item){ switch (item.getItemId()){ case 0: _settings(); break; case 1: _profile(); break; case 2: _about(); break; case 3:  _rate(); break; } return super.onOptionsItemSelected(item); 6) Since I added 4 menus there is only 4 cases. 7) Then add a image with name settings. 8) Then add 4 more blocks. In here I am created  settings ,  profile ,  about ,  rate  . That,s all. Save and run project...

Add menu in actionbar in Sketchware

Image
1) Create a sketchware project. 2) Add a more block extra . 3) In that more block extra do as below:- 4) Code used in First ASD block is:- } @Override public boolean onCreateOptionsMenu (Menu menu){ menu.add(0,0,0,"Settings"); menu.add(0,1,1,"Profile"); menu.add(0,2,2,"About"); menu.add(0,3,3,"Rate now"); return true; 5) Code used in Second ASD block is:- } @Override public boolean onOptionsItemSelected(MenuItem item){ switch (item.getItemId()){ case 0: _settings(); break; case 1: _profile(); break; case 2: _about(); break; case 3:  _rate(); break; } return super.onOptionsItemSelected(item); 6) Since I added 4 menus there is only 4 cases. 7) Then add 4 more blocks. In here I am created settings , profile , about , rate . That,s all. Save and run project...

Share any file from External Storage in sketchware

Image
1) Create a new sketchware project. 2) Add a Button with id button1 . 3) Add a FilePicker with name g and with file type */* . 4) In button1 onClick event do as below:- 5) Add a string variable with name myFilePath :- 6) In on FilePicked event to get file path add a listString str . Set String myFilePath to get at 0 at List String : filePath Then Do as below:- 7) Code used in the ASD block is:- Intent intentShareFile = new Intent(Intent.ACTION_SEND); intentShareFile.setType("application/*"); intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+myFilePath)); startActivity(Intent.createChooser(intentShareFile, "Share File")); That's all. Save and run project...

Swipe Refresh Listview in Chat app

Image
1) Create a new sketchware project. 2) Drag and Drop Linear Layout with id linear1 and height match_parent . 3) Drag Drop ListView with id wb inside that Linear Layout linear1 . 4) Create a new custom xml layout. Add a TextView with id textview1 . 5) Enable AppCompat and Design Library and also Firebase Library. 6) In ListView add custom view as your Custom View. 7) Add a Firebase Component with name as your choice and a ListMap map . 8)In wb  BindCustomView add as your choice. 9)In on Create event do as below:- First ASD code is:- final android.support.v4.widget.SwipeRefreshLayout sr = new android.support.v4.widget.SwipeRefreshLayout(this); sr.setLayoutParams(new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.MATCH_PARENT)); linear1.addView(sr); linear1.removeView(wb); linear1.post(new Runnable() { @Override public void run() { sr.addView(wb); } });  sr.setOnRefreshListener( new android.support.v4...

Swipe Refresh WebView In sketchware

Image
1) Create a new sketchware project. 2) Drag and Drop a Linear Layout with id linear1 and height match_parent . 3) Drag and Drop a WebView with id wb inside that Linear Layout linear1 . 4) Enable the AppCompat and Design Library. 5) In Oncreate event do as below:- 6) Code used in ASD block is :- final android.support.v4.widget.SwipeRefreshLayout sr = new android.support.v4.widget.SwipeRefreshLayout(this); sr.setLayoutParams(new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.MATCH_PARENT)); linear1.addView(sr); wb.getSettings().setJavaScriptEnabled(true); linear1.removeView(wb); linear1.post(new Runnable() { @Override public void run() {sr.addView(wb); } }); wb.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { sr.setRefreshing(false); }}); sr.setOnRefreshListener( new android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { w...