Java "blocks" (utilities) for App Inventor...

780 views
Skip to first unread message

Valter Fukuoka

unread,
Mar 7, 2014, 6:57:56 AM3/7/14
to mitappinv...@googlegroups.com


Hi everybody.

After thinking about 2 weeks on the subject and making some tests, I decide to share so that others can use the idea directly or improve it and create something more useful…

 

The idea is to extend the power of the current App Inventor by providing a set of Java-Android “utilities” that can be invoked by App Inventor (ActivityStarter).

 

The main goal is to have small Java programs, very easy for everyone to understand, use and modify. Then have it in binary form (apk) and Java Source code, so that others can simple “copy and paste” these little utilities, WITHOUT the need to know Java programming. Or, the people who want more can use the existing code as template and create a new function that is not available yet…

 

In some way is something like a “GNU utility collection for App Inventor”, as a collection of functions that can be invoked by App Inventor blocks… of course, not intended to be sophisticated as the GNU tools, instead a collection of functions to overcome some current limitations…

 

Here is an actual working example (decimal to binary {or hex} converter):

https://sites.google.com/site/jaiautils/example

 

I also did some tests with filesystem read/write and "cloud" stuff using BittorrentSync (as cloud), and intend to document more about these ideas so that it may inspire or be useful for App Inventor users…

 

Regards all,

Valter


Taifun

unread,
Mar 7, 2014, 8:52:29 AM3/7/14
to mitappinv...@googlegroups.com
this is a nice example and also very well documented!

probably you already know, that there are already some tools around?
and probably even more?
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Valter Fukuoka

unread,
Mar 7, 2014, 10:56:41 AM3/7/14
to mitappinv...@googlegroups.com
Taifun, hi. Thanks for the comment.

I did saw your "puravida" website, did not have a chance to look at all information, lots of good stuff there.
I am already using your tip to use the <title> from a webpage to "read" information inside a App Inventor app... nice tip.

Thanks for pointing the asUtil, I will take a look at it also.

Valter

Taifun

unread,
Mar 7, 2014, 12:31:35 PM3/7/14
to mitappinv...@googlegroups.com
as I can see from your example, you are returning the value in the ActivityStarter.ResultUri 
you also can return it in the result value of the Activity Starter, you only have to define the result name in App Inventor. 

for a complete example see here http://puravidaapps.com/savetosd.php


Then in Java use this snippet (see also https://groups.google.com/d/msg/ai4a/rK0ddDq-9b8/fqwqUzEG1vgJ):
Taifun

Bundle bundle = new Bundle();
bundle.putCharSequence("APP_INVENTOR_RESULT",filename); 
Intent mIntent = new Intent();  // creates an intent to send app inventor a result
mIntent.putExtras(bundle);
setResult(RESULT_OK, mIntent);
finish(); // closes the app and returns to app inventor

Valter Fukuoka

unread,
Mar 7, 2014, 1:19:14 PM3/7/14
to mitappinv...@googlegroups.com
Taifun, thanks for this tip on sending back info other than "resultURI", I did try it earlier with different approach and get unstable results, then I ask a question here on the forum and Hal Abelson point me to use the "resultURI"...

I will try again using the code you posted...

[I/O]
I did some tests combining I/O with Dropbox and BittorrentSync,
as well as http by Python "server" (https://sites.google.com/site/soft3bridge/home),
trying to make Droid to PC link... seems that we can do very interesting stuff combining all...

Also a little demo on App Inventor to the "physical world": https://sites.google.com/site/droid2pcio/

App Inventor combinations and possibilities are really exciting... and if we can add a little bit of Java together...

Valter

Scott Ferguson

unread,
Mar 7, 2014, 2:07:59 PM3/7/14
to mitappinv...@googlegroups.com
Nice work, Valta :)
I would add that we have the ability to call another App Inventor app with open another screen with plain text and close screen with plain text.
That also uses an activity starter but the user could make their library in AI blocks and not have to learn Java.
Passing lists and non-text data may be a bit of a stumbling block unless the text can be encoded/decoded.
JSON might be useful there.
---
Scott

Valter Fukuoka

unread,
Mar 8, 2014, 2:56:28 AM3/8/14
to mitappinv...@googlegroups.com
Hi Scott, thanks for the reply.

I also like to emphasize that expecting or stimulating people to learn Java IS NOT my main goal,
instead, to create a set of small Java code samples that can, ALMOST be copy/paste/modified to allow people to access Java functions inside the App Inventor app.

Since the basic stuff can be easy to achieve, I believe that if people know that the possibility exist and that it can be simple, this knowledge can help them extract more and go further with App Inventor creations...

I am preparing a short videoclip, where I intend to show a little bit about the current Android SDK, since I believe THIS IS the critical point for beginners.
I mean, I think that the difficulty is more connected with the Eclipse environment itself other than the implicated Java commands...

Valter

Scott Ferguson

unread,
Mar 8, 2014, 11:00:50 AM3/8/14
to mitappinv...@googlegroups.com
I agree.
There are numerous functions available to Java that are not available in App Inventor.
Keep up the good work!
---
Scott

Valter Fukuoka

unread,
Mar 15, 2014, 5:21:34 AM3/15/14
to mitappinv...@googlegroups.com
Hi everybody.
Just want to report here that I did a series of small (90 seconds) videos showing that the ANDROID SDK (Java Android Programming) can be very easy to use...

The level of the videos: very-very easy...

https://sites.google.com/site/setandroidsdk/

1) Download SDK
2) Unpack
3) Run (for the first time)
4) Create blank project (blank skeleton program)
5) Compile (create the .apk) to binary executable
6) The .apk executable package
7) Run on the Device
8) Run on the Soft Emulator
9) Copy a project (duplicate)
10) Delete a project
11) Export a project
12) Import a project

Enough instruction to allow testing the JAIA example above(below):
https://sites.google.com/site/jaiautils/example

I am planning few more videos showing how to deal with some basic Java code...
Regards all,
Valter

Valter Fukuoka

unread,
Mar 22, 2014, 7:08:07 PM3/22/14
to mitappinv...@googlegroups.com
This is the first REAL/PRACTICAL utility, using the JAIA concept:

Base Converter (dec, bin, hex mutual)
https://sites.google.com/site/jaiautils/converter

Binaries and source code available for download.

Screenshot: https://dl.dropboxusercontent.com/u/29669031/etc/jaia-converter-2-mini.JPG

Regards,
Valter

Brown Bear

unread,
Feb 3, 2015, 11:16:19 PM2/3/15
to mitappinv...@googlegroups.com
@Valter: Thanks for your contribution.

@Taifun: Hi Taifun, great to see you here. Btw, I am doing your tutorial http://puravidaapps.com/id.php. How do you make  a small Java app ? Is it in Eclipse or Android Studio? I am quite newbie here. Thank you

Brown Bear

unread,
Feb 4, 2015, 3:44:47 AM2/4/15
to mitappinv...@googlegroups.com
@Valter @Taifun: Hmmm from the things that I understand after reading your posts, It means that the users need to download two apk in order to make the app inventor program runs well?

Is there anyway that we can integrate it in only one apk (App Inventor +Java)? Thank you

Regards,

Brown bear

Valter Fukuoka

unread,
Feb 4, 2015, 5:37:08 PM2/4/15
to mitappinv...@googlegroups.com
Hi, I think there is a group working on allowing Java code directly from the visual-editor...

The JAIA idea that I did is ANOTHER app that you can USE, as a collection of functions, each one as a SEPARATED app... unfortunately...
Reply all
Reply to author
Forward
0 new messages