My project is to big to load

Hello,
I have a problem with my project. I have 3000+ blocks on my screen and it takes about 8 to 10 seconds to load with my smartphone. There where 50 Pizzas on it. Is there any possibility to make it work better? Or should i use another screen so i can make 25 - 25 Pizza? Here is my code:

. I have to make it a little bit smaller. Is there a possibility to not load the whole screen at once? So when you scroll down to load the images and all?

A way to make your code smaller-

Use this block to add all the numbers in a list

Instead of adding each and every variable make a list of these variables and place that list in the parameter of the procedure block.

2 Likes

Even better would be creating a return procedure, which adds all the variables, instead of creating one which reqires them as inputs.

Hello Kedy

You have six or more screens? That sounds excessive for such an App and of course that makes it 'heavy' it terms of size, use and complexity.

Have you optimized your Images for Android?
See my site:
https://www.professorcad.co.uk/appinventortips#TipsImages

I am going to paste a copy of an appropriate project here so that Yandex translator can help you with it ...

Fruit Stand

Abe Getzler

May 2020

Fruit Stand

Motivation

Sample Run

Purchasing screenshots

Designer

Price and Sales Storage

Setting Prices

when lpkFruitPrices BeforePicking

when lpkFruitPrices AfterPicking

when btnSave Click

Starting a Sale

when lpkFruit BeforePicking

when lpkFruit AfterPicking

Quantity

when btnAdd Click

Show_sales

Describe

Quantity

Price

Cost

when lpkSale AfterPicking

Gallery Link

More Projects

Motivation

This sample app is designed to show how to use multiple TinyDB Namespaces in a simple application. It also shows how to add up a list of costs to get a total cost.

The app was developed for https://groups.google.com/d/msg/mitappinventortest/NF6j--NJc-E/hPfG8JDwFQAJ

Sample Run

A List Picker menu lets you set up your price list or jump into setting up a sale.

The Fruit Prices Arrangement lets you set up fruits (i.e. Cackle Fruit, sold by the dozen) and their prices ($3.49 per dozen).

Purchasing screenshots

The Purchases Arrangement lets you build a sales list for the current customer, telling which items they are buying and how many (or how much) of each item they want.

For convenience, there is a +1 button to increase the quantity requested on the current item. Here the customer decided he needs an extra dozen Cackle Fruit, so his total cost went up from $8.01 to $11.51. (Extra items in his purchase are not shown in this screen shot. They are in the scrollable label at the bottom.)

Designer

At the top of Screen1 is the list picker lpkMenu, which lets you pick which of the two vertical arrangements you want to work in, varPrices or varSales. Only one of them is visible at a time.

Price and Sales Storage

Two TinyDBs are used for this app,

  • TinyDB_Prices keeps the price per item type, indexed by item type. It stays relatively stable (assuming low inflation.)
  • TinyDB_Purchases keeps the quantity of each item type bought for the current purchase in progress. It is cleared after each purchase for the next customer.

Notice the different Namespace attributes for the two TinyDBs. That’s critical to keep the tag values apart, since all the tags (item types) in TinyDB_Purchases are copied from the tags in TinyDB_Prices.

Setting Prices

(see Sample Run for screen shots)

when lpkFruitPrices BeforePicking

The list of fruit types in the price list comes from the tags in TinyDB_Prices, and is used to load the Elements list of lpkFruitPrices, which is used to select the fruit type for which we want to set a unit price. An extra element “(+)” is added to the front of the list to offer the option of adding a new item to the price list.

when lpkFruitPrices AfterPicking

The list picker lpkFruitPrices is used to prime two text boxes with their initial values:

  • txbFruit.Text contains the selected fruit name (or blank if new)
  • txbUnitPrice.Text contains the lookup value for the selected fruit, or whatever entered value if new.

when btnSave Click

The Save button adds or replaces a unit price into TinyDB_Prices. To signal completion, it clears the txbUnitPrice text box and hides the keyboard.

It does a little bit of data cleaning to make sure the price is a number, or 0.

Starting a Sale

The sales process uses two List Pickers,

  • lpkFruit for selecting a fruit type from the price list and adding it to the current sale
  • lpkSale for displaying the current running subtotals of this sale and giving the opportunity to go back and change item quantities before sale completion.

when lpkFruit BeforePicking

The options to buy fruit come from the price list in TinyDB_Prices’ tag list.

when lpkFruit AfterPicking

When a fruit type is selected, the quantity for that fruit type in the current sale is retrieved by procedure quantity based on lpkFruit.Text, the current Selection.

Quantity

when btnAdd Click

Button btnAdd is used to store the new quantity for the Selected fruit type to TinyDB_Purchases. Afterwards, we update the display and ListPicker lpkSales via routine show_sales.

Show_sales

The list picker lpkSale is serving double duty here. Its .Text value is built up to show all the purchases in TinyDB_Purchases, with price and cost, separated by ------- and new lines (\n).

Procedure describe is used to build each Element in lpkSale and procedure cost is used to calculate the cost of each purchase in TinyDB_Purchases. (See Purchasing screenshots)

Describe

The description of an item on the simulated cash register tape is built up from the purchased item type, the quantity of that item, its unit price, and the cost for that quantity of that item type.

Quantity

Price

Cost

when lpkSale AfterPicking

Picking an item off the simulated cash register tape in lpkSale sets it up in lpkFruit.Text for the item type and txbQuantity for the current quantity of that purchase, should the customer decide to change it via btnAdd.

Gallery Link

http://ai2.appinventor.mit.edu/?galleryId=5298226067537920

More Projects