Make code expandable

Hello, Iโ€™m starting to learn Java, and I want to make this code extensively, how can I do that? This is the code:

When instead of your text there will be text that he will insert in the extension. (Let there be a block that receives the text for the variable that is defined there, and another block that will run this code.)

Toast.makeText(MainActivity.this,"Your Text",Toast.LENGTH_LONG).show();
2 Likes
@SimpleFunction
public void showToast (String text) {
    Toast.makeText(container. $context, text, Toast.LENGTH_LONG).show ();
}
3 Likes

Okay, how do I do this as an extension that will have a block that will receive the text and a block that will run the function? Thatโ€™s what I asked. (I do not know how to develop extensions, I only know a little Java โ€ฆ).

You can use rush to create extensions. Watch tutorials on youtube.
https://youtube.com/channel/UCSSQg8iowZRTSP4kCypUYdw

2 Likes

Thanks, but Iโ€™m not currently at home so the computer is not near me, so I prefer to mess with codes because there is the site of development extensions, and I need it there โ€ฆ If you can help me I would be happy.

What does this code do?