Search

Custom Toast message in Sketchware

click here




To create a custom Toast message in Sketchware, follow the steps given below



  • This is main.xml




  • Create a customview name with custom1

  • Add linear1 and textview1, custom.xml as shown in the image.





  • Customize the textview1 and linear1 as per your requiremen

  • In LOGIC area, add a new More Block with name customToast(String _text) as shown in image below.



  • Next define this customToast Block. In event customToast MoreBlock use add source directlyblock, and in the block, write codes as described below.



LayoutInflater inflater = getLayoutInflater(); View toastLayout = inflater.inflate(R.layout.custom1, null);

TextView textview1 = (TextView) toastLayout.findViewById(R.id.textview1);
textview1.setText(_text);
LinearLayout linear1 = (LinearLayout) toastLayout.findViewById(R.id.linear1);

Toast toast = new Toast(getApplicationContext()); toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(toastLayout);
toast.show();



  • Use the more Block whenever you want to display a custom Toast, as shown in image below.



  • Now save and run




Are you like to earn money with link sharing.

You can earn per vist 0.025$. (only this referal link)
Click to register


Today : paid - 2201956$ registered - 23435 link visited - 453566577

Post a Comment

0 Comments