Copy blocks to another screen MIT App Inventor

user2990406 picture user2990406 · Jul 21, 2014 · Viewed 17.8k times · Source

I published my app that has many screens, but now I want to go back and add a new feature to those screens. Is there any way that I can just create the new blocks once as a template and paste it to the new screens?

Answer

Taifun picture Taifun · Jul 21, 2014

copy-paste of code blocks is not a good idea: instead of creating redundant code, you should think about a redesign of your app, see the following link for more details.

Building apps with many screens

If it seems that your app requires a large number of screens, you might think about redesigning it to not use so many. For example, suppose your app has to show several different screen images all with the same functionality but each image having a different background. One way to code this would be to use a different App Inventor screen for each image, each screen with its own background image. With that method, you’d need as many screens as there are images. But another way to code this is to have only a single screen and change the screen background. Similar ideas apply to other kinds of elements: If each screen image has a label with its own text message, then rather than having multiple screens, each with its own label, you could have a single screen and a single label, and just change label’s text.

In App Inventor, you only can copy a complete screen, see the following method

How to copy screens by Scott and a video by Hossein

EDIT: now there is the new backpack cut-and-paste system

The Backpack allows you to carry around blocks throughout your project repositories, allowing blocks to be transferred between projects and between screens. The contents of the Backpack persist throughout an App Inventor session. (NOTE:When you quit your App Inventor session or refresh the App Inventor page in the browser, the Backpack will be emptied -- i.e., re-initialized.)