Speed compared to Basic4ppc?

colin9876

Active Member
Licensed User
Im very excited about this Basic4Android.
I gave up on Windows Mobile last year, at version 6.5 I felt they had enough chances and am now an Android convert! :eek:)

Im wondering how the running speed will compare in this product compared to Basic4ppc. When I was doing a 'sand box' graphical game a couple of years back the speed restriction on many moving grains of sand was a limitation. With Android is there any chance that line drawing, plotting may be bit faster?

Also I would be interested on Erels opinion whether the Android/linux set up is more complicated or less complicated over all. I guess the Windows .NET layer is no longer required but is the Android / Linux equivalent just as complex ??
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Im wondering how the running speed will compare in this product compared to Basic4ppc.
Basic4android performance is similar to the performance achieved by writing the code in Java.
The emulator is pretty slow, but on real devices things look good.

Also I would be interested on Erels opinion whether the Android/linux set up is more complicated or less complicated over all.
The set up does require installing several tools.
There are two step by step tutorials which should make things simpler in the tutorials section: Basic4android Getting started & Tutorials - Basic4ppc / Basic4android - Android programming
 
Upvote 0

colin9876

Active Member
Licensed User
Great stuff
ok Im set up now, that wasnt too hard, but I do notice the emulator is very slow and sluggish.

Still its good to hear its faster on the actual device.
Just to start me off Erel is the line draw, and plot commands same as in Basic4ppc?
say I want something like
For i =1 to 300 / draw line of
plot (50,i, RGB(255,0,0)) /red dots
next i

whats the syntax of that plot command?

Thanks
 
Upvote 0

colin9876

Active Member
Licensed User
Thanks Erel,
Thats just what I needed,

Re Activity.Invalidate??
Can you just tell me what those two Activity commands are?
What would happen if you dont have them?
Basic4PPC didnt need that type of command?

Many Thanks again
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You could consider :
-Activity similar to a Form in B4PPC.
-Activity_Create similar to App_Start
-Activity.Invalidate similar to Form.Refresh.
If you omit Activity.Invalidate the activity (form) will not be refreshed like in B4PPC with a drawer object where we need Form.Refresh.

For graphics there does exist a 'control' similar to the Drawer object from the ImageExLib, and graphic methods.

Best regards.
 
Upvote 0

colin9876

Active Member
Licensed User
Thanks Klaus.
Ive tried that program now and it draws a red line, woohoo success!
But it shows it all in one go at the end of the run.
if I want the line to be drawn point by point what 'refresh display' command is it I add within the For-Next loop?

is there un update canvas(activity) type command?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You should (could) use this code.
B4X:
[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]btn2_Click[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] canvas1 [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b]Canvas[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]  canvas1.Initialize(Activity)[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]  For[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] i = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0 [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]To 3[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]00[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]    canvas1.DrawPoint([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]50[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],i, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Colors[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].Red) [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]'Or Colors.RGB(255,0,0) [/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]    DoEvents[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]    Activity.Invalidate3([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]50[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],i,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]50[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]+[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],i+[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]  Next[/COLOR][/SIZE][/FONT]
[SIZE=2][FONT=Courier New][COLOR=#0000ff]End Sub[/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]

Best regards.
 
Upvote 0

colin9876

Active Member
Licensed User
Ok its all working well on the Emulator, but Im stuck getting it onto the Device.

I did compile and run with my Android 2.2 phone connected with the USB wire but it didnt seem to know to go over to the device. It just said something about the Emulator not running.

Is there anything I have to configure to tell it to put it on my device?

By the way when I put the USB lead in, it said Turn on USB storage, I said No to that??
 
Upvote 0

colin9876

Active Member
Licensed User
Thanks Erel,
I hadnt downloaded the USB v3 item, because it wasnt it the Respository list. I think its been updated
There is a USB v4 under Google add ons, Ive downloaded that.

Ive now ticked the phone setting to allow USB debugging.

Still not working, what I want to try is just copying the coplied file straight over to my SD card and running that.
If my programs called test, what will be the compiled file name and where on my C drive should it be? Ive looked where the test.b4a source code is and theres no folder there with a compiled file??
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
Read this carefully.

Not all devices seem to be able to communicate with adb and adb does not know about all devices.

If after checking Settings -> Applications -> Development -> USB debugging and plugging in your phone Windows doesn't ask for drivers for USB interfaces "Android ADB Interface" and "Android Composite ADB Interface" then your phone doesn't support connection to adb. As far as I know nothing more can be done about this as it is a manufacturer decision.

If Windows does ask and you point it at the USB driver in the Android SDK and it doesn't recognise the driver then the driver android_winusb.inf does not contain the information for your phone. It didn't know about my Orange SanFrancisco (ZTE Blade) so I had to Google to find the entries and add them to the file myself.
 
Upvote 0

colin9876

Active Member
Licensed User
ummm as Windows didnt ask me I guess my phone doesnt support it then.
Just FYI mobile is a LG p500 (Optimus one). Just on a side note I paid more for this phone than the San Fran (which looks great value) because I thought being 2.2 it would run Flash.
As it turns out it doesnt, apparently the HVGA screen res doesnt allow it!

Anyway Andy please can you tell me where I will find the compiled file on my computer, and what the .extension is and Ill just move it over to the SD card manually
Thanks
 
Last edited:
Upvote 0

colin9876

Active Member
Licensed User
Brainwave

Thanks everybody!
Hey Ive had a brainwave, I was thinking .....
As Basic4Android goes via a Java compiler, is there a java executable in that APK bundle that can be run directly on desktops
i.e. what Im thinking is rather than running the program through an Emulator, could I just run it in Windows - it would be must faster as the emulator is slow??

What Im thinking is, without anymore development, surely this Basic4Android could also be a Basic4Anything producting Java that can run anywhere??
:sign0060:

Java is fairly machine independent right, so it seems a huge opportunity?
Is there a catch anywhere I havent spotted why these Java executables cant be run directly on Windows/Macs/Linux
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
surely this Basic4Android could also be a Basic4Anything producting Java that can run anywhere??
No. The compiled Java is linked to the Android runtime libraries and uses the Android OS application architecture and GUI. You would need a desktop implementation of the entire Android OS and its APIs running under Windows which does not, and is highly unlikely to ever, exist.
 
Upvote 0
Top