Android Question Code check please

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Hi:

I am a retired MFC C++ programmer and was using Xamarin Studio to learn Android programming. Their new pricing scheme is just too outrageous for me, so I figured I would try my hand at Basic4Android.

I am attaching a sample of a program I had written in C# for Xamarin noe converting to Basic4Android for a Bowling Scoring / Stats program.

Willing to listen to any Ideas on how to do things better.

Basically this program displays ten images representing the pins. There are Four states. Before a ball is rolled Selected and Unselected and After a ball is rolled Selected and Unselected. I did not see a good example of StateListDrawable using 4 different images so I did it the hard way.

Please remember I am 63 and this is my first Basic program (never had a desire to learn basic).

Thanks

BobVal
 

Attachments

  • BowlingStats.zip
    351.2 KB · Views: 245

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You should add all the files that you are using to the Files tab.
2. The code looks fine. I always try to avoid writing "duplicate code". You can improve the code that loads the images.
For example:
B4X:
Dim names() As Array = Array As String("one", "two, ...
For i = 0 To names.Length - 1
PinsImages( i + 1, 0, 0) = LoadBitmap(File.DirAssets, names(i) & "pin.png")
PinsImages( i + 1, 0, 1) = LoadBitmap(File.DirAssets, names(i) & "pinselected.png")
...
Next

You can go further and create a Pin class which holds the bitmaps and other information.

3. You should either lock the orientation to portrait or make a landscape variant.

4. Check your layout in the UI Cloud (F6). It doesn't look so good on tablets.

this is my first Basic program (never had a desire to learn basic).
Basic4android is not really "Basic". It is more similar to VB.Net.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…