DIR=/home/eric/JavaFXAndroid - the output directory.NAME=JavaFXAndroid - Name of the target Android project.PACKAGE=com.JavaFXAndroid - package name of Java applicationJFX_SDK=/home/eric/dalvik-sdk - location of downloaded JavaFX-Dalvik Runtime.JFX_APP=/home/eric/NetBeansProjects/com.JavaFXAndroid/dist - The location of the Netbeans JavaFX project.JFX_MAIN=com.javafxandroid.ComJavaFXAndroid - fully name of the main class of your JavaFX ApplicationANDROID_SDK=/home/eric/Android/sdk createProject - location of your Android SDK.

Once successfully finished, switch to the the directory of the generated Android Project, /home/eric/JavaFXAndroid/JavaFXAndroid in my case.

Run the command to generate the APK in its bin directory.
$ ant debug

Then you can run the adb command in bin directory to install the APK to real Android devices.
$ adb install -r -debug.apk

Wednesday, September 24, 2014

It's another example to implement Bi-directional communication between Android and Arduino in USB Host Mode. A button on Andndroid is used to turn ON/OFF the on-board LED of Arduino Uno, and EditText to send string to Arduino Uno. it will be displayed on connected LCD, and sent back to Android.

Notice:
- Sync word of '0xFF' is used to mark the beginning of data, to sync the communication. Extra in-correct '0x00' received in Android side (I don't know why), so have to ignore it. Make sure the data will not be '0xFF' and '0x00'.
- Command 0x01, 0x02, and 0x03 are used to define LED ON, LED OFF, and string of text.
- Data will lost if sent too fast, so I break the message and insert dummy delay between bytes. (inside method sendArduinoText())
- A USB OTG cable is need to connect to Android side, and a normal USB is used to connect USB OTG cable and Arduino Uno.

Monday, September 22, 2014

The Systrace tool helps analyze the performance of your application by capturing and displaying execution times of your applications processes and other Android system processes. The tool combines data from the Android kernel such as the CPU scheduler, disk activity, and application threads to generate an HTML report that shows an overall picture of an Android device’s system processes for a given period of time.

The Systrace tool is particularly useful in diagnosing display problems where an application is slow to draw or stutters while displaying motion or animation. For more information on how to use Systrace, see Analyzing Display and Performance.

Keyboard shortcuts that are available while viewing a Systrace trace HTML report.

Sunday, September 21, 2014

This example implement bi-directional communication in USB Host mode, between Android and Arduino Uno. It's a button on Android, used to turn on/off the on-board LED (pin 13) on Arduino Uno. And a potentiometer on Arduino side, used to control the SeekBar on Android.

This example reference MissileLauncher example in Android SDK, you can locate it in the folder /sdk/samples/android-14/USB/MissileLauncher.

For Android-to-Arduino, command of CMD_LED_ON(1) and CMD_LED_OFF(2) are used to turn ON/OFF the LED on Arduino board. For Arduino-to-Android, '0' will be sent between data (I don't know why), so I force the value sent in the range 1-63.

Thursday, September 18, 2014

Refer to last example of "getView() to load images in AsyncTask", the loading of large images (such as photos from camera/DSLR) is too slow to accept. Most JPG embedd with thumbnail, we can use ExifInterface to check and load if it has thumbnail embedded.

Example to apply Animation on Buttons, and implement AnimationListener to startActivity() when onAnimationEnd() called. Notice that when a animation is running, the buttons still can accept click to start other animation, and create more AnimationListener to start more than one second activity when ended. (It's further work on former exercise "Apply animation on Button")

This post show getView() loading images in AsyncTask, to make UI responsive. Re-call my old "GridView example: load images to GridView from SD Card in background", it load the files in backgroud, to make the GridView start-up faster; but not in loading images in getView. Such that if the GridView going to load large images, it will block the UI in getView() and make the UI unresponsive.

The page advise to check (v.position == position) to varify if this item hasn't been recycled already. But it not work in this case. (actually, I don't understand how is the logic) In my implementation, roll-out images will be shown on incorrect cell, but the final images will replace and correct it finally.

To load images in AsyncTask will not speed up your image loading, but improve UI response.

Tuesday, September 16, 2014

To place groupIndicator of ExpandableListView on right side, we can call setIndicatorBounds() for Android devices before Jelly Bean, or call setIndicatorBoundsRelative() for devices of Jelly Bean or higher.