Android Question Storing My Calculations

Shelby

Active Member
Licensed User
Thanks to one of Erel's tutorials (written) I have 6 rooms in my project and look forward to using the variable i in some way to make the possible number of rooms infinite. Thanks to his tutorial I'm using modules for each room.
 
Last edited:

Shelby

Active Member
Licensed User
still firmly Imperial.
Yes imperialistically feet and inches. When I was in high school and college we were told that eventually we in America would adopt the far superior metric system. Our politicians (who else can I blame) have been dragging their scientific heels for who knows what reason.
 
Last edited:

Shelby

Active Member
Licensed User
You've already given me enough to sort through for the next week minimum.
 

emexes

Well-Known Member
Licensed User
Well I want to bring forward the previous room (s), calculate the new room and add the two.
So what I've got pictured in my mind now is a screen with a [Clear/Reset] button, two fields for typing in the dimensions of a room, a running count and total area, an [Add] button, and a ListView of all the room dimensions you've typed in so far, eg "4000 x 3200 = 12.8 m2", "3000 x 5000 = 15 m2" etc.

When you press the [Clear/Reset] button, it zeroes the count and total area, and clears the ListView.

When you press the [Add] button, if multiplies the length and width fields and adds that area to the total (and increments the count).

(checking IsNumber(LengthEdit.Text) and IsNumber(WidthEdit.Text) first)
 

emexes

Well-Known Member
Licensed User
Do you go smaller than an inch?

Or are are inch fractions decimal, eg 4.75 inches rather than 4 3/4 inches?

I'm very happy to see that yards weren't mentioned :)
 

emexes

Well-Known Member
Licensed User
And what the heck do you do for say: 4'5" x 4'6" ?

Is the answer:

19.875 ft2, or
19 ft2 126 in2, or
19 7/8 ft2, or
2862 in2

???

Holy moly, I can see why this calculator might be useful.
 

emexes

Well-Known Member
Licensed User
I just tried to drop the zip file onto this screen and I got a "Too Big Bro" message.
You got pictures in there?

Or try: Tools, Clean Project

to get rid of all the intermediate compilation files (which will be recreated next time you do a compilation, so: no worries about losing stuff)
 

emexes

Well-Known Member
Licensed User
Decimals are fine for this lesson. I'm getting a screen shot for my emulator view.
If you can convert to jpeg, that may well shrink the file down. PNG's are usually pretty small too. BMP's and TIF's are usually humongous.
 

MarkusR

Well-Known Member
Licensed User
have a look also for useful type (struct)
https://www.b4x.com/android/forum/pages/results/?query=type
example
B4X:
Dim SizeX As Float = Rooms.Get(RoomKey & "X")
Dim SizeY As Float = Rooms.Get(RoomKey & "Y")
B4X:
Type Size(x As Float,y As Float)
Dim a As Size
a.x=1
a.y=2

DoSomething(a)

Sub DoSomething(d as Size)
 ...
End Sub
 

MarkusR

Well-Known Member
Licensed User
O.K. Great,
Thanks Marcus
if you define this type/struct into a class you can add easy a functionality (with public methods like calculate, load, save, add, remove, ...).
also a good thing in b4x is u can use your own struct in a other struct.
B4X:
Type Position(x As Float,y As Float)
Type Wall(start As Position,ende As Position)
dim w as Wall
Dim walls As List
walls.Initialize
walls.Add(w)
 
Last edited:

emexes

Well-Known Member
Licensed User
have a look also for useful type (struct)
My memory's a bit hazy, but I think the reason I went with only using basic types in the map was (i) so that can use WriteMap and ReadMap, and (ii) can just open up the resultant text file and read it (or even modify it).

But for storing and transferring information within a program, you're right, I should use Types more than I do.
 
Top