PART ONE
Introduction
This is a four part tutorial which
will take you through step-by-step on how to create Android apps on
your Mobile device that will allow you to communicate with your Arduino
over Bluetooth. This tutorial is based upon the Windows environment and
an Android device like the Samsung Galaxy S2
Phone.
I will take you through setting up your computer and phone, and will move through in stages so that you understand what each part of the bluetooth code is actually doing. Obviously you will need to ensure that you have a Bluetooth Shield on your Arduino to be able to walk through this tutorial with me.
If you are not interested in the step-by-step instructions, you can jump straight to the end (Part 4) which will have the complete Arduino and Android/Processing code that was used in the following video:
I will take you through setting up your computer and phone, and will move through in stages so that you understand what each part of the bluetooth code is actually doing. Obviously you will need to ensure that you have a Bluetooth Shield on your Arduino to be able to walk through this tutorial with me.
If you are not interested in the step-by-step instructions, you can jump straight to the end (Part 4) which will have the complete Arduino and Android/Processing code that was used in the following video:
The Goal of this project (Video)
Setting up Processing for Android applications:
For the latest and most up to date version, please follow the instructions on this website: http://wiki.processing.org/w/Android
Step One:
Download the Android SDK from this website:
http://developer.android.com/sdk/index.html
Android SDK Download:
Make sure to select the "Use and Existing IDE" link, as per the picture below.

When you select the "Use an Existing IDE" link, it will then show you the appropriate download to use. This is what it should look like.
Select the "Download the SDK Tools for Windows" link.
Once you have downloaded the Android SDK, go ahead and install it as per the instructions below.
These instruction can also be found here.
Installing the necessary packages in the Android SDK Manager program
Make the following 3 selections:
- Tools: Android SDK Platform-tools
- API 10: SDK Platform
- Extras: Google USB Driver
Here is a picture of the Android SDK Manager selections:
While you may decide to download other packages,
you MUST download API 10: SDK Platform .
Do not leave this one out !!
Step Two: Processing Download
Download the latest Processing IDE (version 2.0 Beta 8) from this website:
http://processing.org/download/
I am using Windows 7, and have chosen to download the Windows 32 bit version as shown below.
Load Processing, and switch to Android mode, as per the image below.
You should now have an empty sketch window which looks something like this.
Step Three: Setting up the Android Hardware device (Phone)
For the latest steps you can have a look at this site:
http://developer.android.com/tools/device.html
However, these are the ones that I carried out:
Turn on USB debugging on your Android Phone:
To find out what Android Version you are on, have a look at
Settings > About Phone : look for heading "Android Version".
- My Android version is 2.3.4 on my Samsung Galaxy S2.
Settings > Applications > Development > Select (or Enable) USB debugging
For those of you who have a different Android version, have a look below:

Downloading the USB driver for your Android Phone (Windows Users)
If you are developing on Windows and would like to connect an Android-powered device to test your applications, then you need to install the appropriate USB driver. Have a look at this site for more information on how to download the USB driver for your phone:
http://developer.android.com/tools/extras/oem-usb.html
I have a Samsung Galaxy S2 phone, so I had to go to the Samsung Site here:
http://www.samsung.com/us/support/downloads
But because I am not in the USA, I had to click on the link for "non-US products":
http://www.samsung.com/us/support/downloads/global
You will need the model number of your phone:
On the Samsung Galaxy S2, you can go into
Settings > About Phone => Model number. Otherwise, it is located behind the battery.
- My Phone's Model Number is: GT-I9100

Then I continued with the install of the USB driver as per the document below:
http://developer.android.com/tools/extras/oem-usb.html

Step Four: Android-Processing Sketch
We will now test our our current
setup and make sure that we can run a
simple Processing Sketch on the Phone. Bluetooth functionality will be
tested later on, so all we need for this step, is our computer, our
Android phone, and a USB cable. While it is possible to run this sketch
without an Android phone (by using the emulator), I personally do not
have the patience to wait an eternity while the emulator boots up...
(yes, it takes an eternity)... In this tutorial, we are going to test
it on the device (phone).
This sketch has an orange background and a black circle which you can move around the screen with your finger (that's it) - I did say it was going to be a simple sketch.
This sketch has an orange background and a black circle which you can move around the screen with your finger (that's it) - I did say it was going to be a simple sketch.
Copy and paste the following Android-Processing sketch into the IDE, and then press the (Run on Device) button, which is the triangle button or press Ctrl-R.
Android/Processing Sketch 1: Circle Dragger
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/*Circle Dragger: Simple Android-Processing Sketch written by ScottC on 13/03/2013. Visit: http://arduinobasics.blogspot.com/ */ int circleWidth = 150; void setup(){ orientation(LANDSCAPE); } void draw(){ background(255,100,0); fill(0); ellipse(mouseX,mouseY,circleWidth,circleWidth); } |
You should see an orange screen
appear on your phone. Move your finger
across the screen and watch as the black circle follows your finger.
No, not rocket science, but hopefully everything worked as planned. If you want to change the colour of the background or circle, this is a good site:
http://www.colorpicker.com/
No, not rocket science, but hopefully everything worked as planned. If you want to change the colour of the background or circle, this is a good site:
http://www.colorpicker.com/
Step Five: Bluetooth testing:
We are now going to walk through
Bluetooth connectivity. While we could
just use a library to do all the heavy lifting for us, I decided to
explore Bluetooth functionality from scratch. This will hopefully
provide greater returns in the long run. Ok, lets create a new
Android/Processing Sketch which changes its behaviour depending on
whether Bluetooth is enabled or disabled when the sketch is run. We
will display a red screen when Bluetooth is switched off, and green
when Bluetooth is switched on.
To enable Bluetooth on my Samsung Galaxy SII phone:
- Settings >Wireless and Network > Bluetooth Settings > Bluetooth (Turn on Bluetooth) - check the box
To disable Bluetooth on my Samsung Galaxy SII phone:
- Settings >Wireless and Network > Bluetooth Settings > Bluetooth - Uncheck the box
In the processing/android IDE, you need to make sure that you update the AndroidManifest.xml file to grant specific permissions. You can either edit the file manually in the sketch folder, however, it is much easier and safer to do the following. In the processing/android IDE, select:
- Android > Sketch permissions (as per the picture below)
- Make sure that BLUETOOTH and BLUETOOTH_ADMIN are selected (as per
the picture below). Then press the OK button.
Then copy and paste the following sketch into the processing/android IDE:
Android/Processing Sketch 2: BluetoothChecker1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/*BluetoothChecker1: Written by ScottC on 17 March 2013 This will show a red screen if Bluetooth is off, and a green screen when Bluetooth is switched on */ import android.bluetooth.BluetoothAdapter; BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); void setup(){ orientation(LANDSCAPE); } void draw(){ if(bluetooth.isEnabled()){ background(10,255,30); } else { background(255,10,30); } } |
When you run the BluetoothChecker1
sketch on the device, you will
either see a red screen or a green screen depending on whether you had
Bluetooth enabled or disabled at the time. Ok, pretty boring, but it is
a start. What if we wanted to ask the USER if they would like to enable
Bluetooth at the beginning? We could then change the appearance of the
screen depending on their selected answer. Before we add this
functionality, I would recommend that you read about the following
concepts introduced in the next sketch.
- startActivityForResult : used to create a new Activity. We create a new Activity to ask the user for permission to enable Bluetooth.
- onActivityResult: called when the Activity exits. We use this to find out whether the user granted permission to turn on Bluetooth or not.
- BluetoothAdapter.ACTION_REQUEST_ENABLE : This is
action we want to take when we launch the activity.
- android.content.Intent
: Mostly used when launching activities.
Android/Processing Sketch 3: BluetoothChecker2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
/*BluetoothChecker2: Written by ScottC on 17 March 2013 If Bluetooth is already ON when you run this sketch, the background will display BLUE. If Bluetooth is OFF when you run this sketch but you agree to turn it on, the background will display GREEN. If Bluetooth is OFF when you run this sketch and then choose to keep it off, the background will display RED. =======================================================*/ import android.bluetooth.BluetoothAdapter; import android.content.Intent; int BACKGND=0; //Set the background to BLUE //Get the default Bluetooth adapter BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); /*The startActivityForResult() launches an Activity which is used to request the user to turn Bluetooth on. The following onActivityResult() method is called when the Activity exits. */ @Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data){ if(requestCode==0){ if(resultCode == RESULT_OK){ BACKGND=2; //Set the background to GREEN } else { BACKGND=1; //Set the background to RED } } } void setup(){ orientation(LANDSCAPE); /*IF Bluetooth is NOT enabled, then ask user permission to enable it */ if (!bluetooth.isEnabled()) { Intent requestBluetooth = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(requestBluetooth, 0); } } void draw(){ if(BACKGND==0){ background(10,10,255); //Set background to BLUE } else if(BACKGND==1) { background(255,10,10); //Set background to RED } else { background(10,255,10); //Set background to GREEN } } |
Useful Links:
Android Processing Wiki: http://wiki.processing.org/w/Android
Here is a good tutorial which helped me put Processing and Android together:
http://www.creativeapplications.net/android/mobile-app-development-processing-android-tutorial/
And most importantly:
The Android Developers site : Bluetooth
Click here for PART TWO
Click here for PART THREE
Click here for PART FOUR
If you like this page, please do me a favour and show your appreciation :
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
Have a look at my videos on my YouTube channel.
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
Have a look at my videos on my YouTube channel.
Feel free to share this page with your friends in any way you see fit.

very nice
ReplyDeletecheers from india
Thanks Nikhil
DeleteHello. Thanks for the tutorial. However I am facing a severe problem. After installing the Android SDK, Processing , Java SDK and all that is necessary, I copied your code and ran the sketch.
ReplyDeleteThe problem is that the sketch can't seem to open the emulator. No AVD device had been created for it. So I manually created one called Processing-Android-10, but I am still getting the same error.
My sketch refuses to open in an emulator. Since I don't have an android phone, this is the only option I have. I have Android 17 and 10 APIs installed.
I am currently using Processing 2.0b9 64 bit. Please Help!!
Hi piyush
DeleteUnfortunately the emulator does not have Bluetooth emulation. So this will not work. You will need to find a friend with an Android device.
Well thanks for replying. I pasted the sample code that ie generating a simple orange background. My emulator refuses to open. It shows the Trying to close ADB server and then "Connection to Device lost". Tried Google and stackoverflow for hours but still couldn't resolve it. Though you might help.
DeleteI understand I would need an Android device to check the Bluetooth emulation but I wanted to test it out in an emulator any ways just to check if it was crashing.
Btw the app I am making is a little different from yours. I am receiving data from the arduino instead of sending it. I am using your code as a reference. So thank you for the well detailed tutorial.
Anyways if you could help with my problem, I would be really glad.
Hi Piyush,
DeleteYou will not be able to test out anything related to Bluetooth in the emulator - it will crash or fail to load (because Bluetooth is not supported in the emulator). You can try sketch 1 in this tutorial. Sketch 1 should work in an emulator.
As per the Processing-Android wiki: "You can't install API 13 or 14 or 17 just because it's newer". At this stage, the processing IDE only supports version 10. Remove API 17 and see how you go.
Scott
Sketch 1 is the one that I was trying to test the processing IDE with in the 1st place. My Android SDK has both API 17 and 10 installed.
DeleteRemove API 17 and try the most basic of sketches.
Deletevoid setup(){}
void draw(){}
If that doesn't work, then you have an issue with your processing IDE/API .
Hi Piyush,
DeleteThe other thing you may want to try is to use the 32 bit version of Processing. I have had some issues with the 64 bit version in the past, mainly because I use Serial quite a lot and Serial is currently not supported in the 64 bit version.
Hope you managed to figure it out.
I have debugging enabled on my Galaxy S3 and running "adb devices" from the command line shows it is connected. However, when I select "Run on Device" processing (32 bit) loads everything up but seems to get stuck on "Installing sketch on 381e82b1." The basic circle dragger sketch never shows up on my phone. Any advice?
ReplyDeleteMake sure not to use a later version of the ADK. Use version 10.
DeleteHave you installed the USB driver? Other than that, am not too sure.
Thanks Scott. I do only have the API10 installed. However, I did get a bit confused by the driver install instructions. I downloaded the driver for my phone from Samsung. What is unclear is if I was supposed to install that one, the one in the sdk/extras directory, or the Samsung first and then update with the one in the sdk/extras directory. Can you clarify?
DeleteI am not sure if the order is important, however, I wrote the instructions in the order that I did it in. Most of the setup instructions can be found at the Android/Processing wiki . That site should have the most up-to-date instructions, and also provides some extra information for Mac and Linux users. I am currently using Windows 7.
DeleteHey Timothy, after reading back on my instructions, I can see why you got confused. I apologize, my instructions are not clear, nor are those that I followed. I am sorry.
I am pretty sure that I installed the Samsung USB driver, and then updated it with the google USB driver.
Thanks for the clarification Scott! I will give that a shot!
DeleteLet me know how you go. I will clarify the tutorial based on your response.
DeleteHey Scott!
ReplyDeleteThanks a lot for your tutorial. Was looking for something exactly like this.
Using your code as a reference and it works like a charm.
Thanks Krishna, I appreciate the feedback, but more importantly, I am glad it worked for you and that you got something out of it.
Deletedoes this works with any version of adroid like Android v4.0.3 (for my tablet)?
ReplyDeleteI have no idea. I have only blogged about my experience. But feel free to come back and let me know if it worked for you. As I am sure it will help others, or save them the time.
DeleteHey scott,thanks for your tutorial
ReplyDeletei have a doubt when i am running the program i got following errors on console
window like
debug:
Shutting down any existing adb server...
bleh: adb devices
status: 1
7875ms
stdout:
stderr:
error: protocol fault (no status)
Shutting down any existing adb server...
i am no vice about this.what should i do? please give any suggestion
thanks in advance..
HI Bharathi,
DeleteI have no idea. Perhaps try posting your query on the processing forums. Someone there might be able to help ???
I wish I could help you, but I don't know the answer to that one. I look forward to hearing back from you (when you find out what it was).
Sorry
Scott
thx for your sharing.. next time i will try this tutorial..
ReplyDeleteand god bless you
regard from indonesia :)
I was able to get sketches one and two working but 3 force closes on both phones I've tried it on.
ReplyDeleteI got this out of processing after it crashed on my GS4:
--------
FATAL EXCEPTION: Animation Thread
java.lang.SecurityException: Permission Denial: starting Intent { act=android.bluetooth.adapter.action.REQUEST_ENABLE cmp=com.android.settings/.bluetooth.RequestPermissionActivity } from ProcessRecord{43923480 14317:processing.test.sketch_130923c/u0a10227} (pid=14317, uid=10227) requires android.permission.BLUETOOTH
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2162)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1429)
at android.app.Activity.startActivityForResult(Activity.java:3430)
at android.app.Activity.startActivityForResult(Activity.java:3391)
at processing.test.sketch_130923c.sketch_130923c.setup(sketch_130923c.java:66)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)
--------
Make sure to enable Bluetooth permissions on each project
DeleteYou are a gentleman and a scholar. Thank you very much.
DeleteHi,
ReplyDeleteI am currently running your code under step 4, and I keep getting an error stating: "error from inside the Android tools, check the console." I have downloaded the ADK tools as stated in the tutorials and selected the approprate packages as well as switched processing over to Android mode. Would you be able to help steer me in the write direction here? Your help would be greatly appreciated.
"SDK", I should say....
Delete"the RIGHT* direction..." my apologies for the numerous typos. It was early when I typed this.
DeleteI've got the same problem with you..hope Scott can help
DeleteNot sure. Processing has changed a bit since I wrote this tutorial. May need to try again myself to see if the process still works.
DeleteDo you meet the system requirements?
Have you installed JDK 6? If not, then maybe try it and see if that works.
Otherwise - maybe try the Processing.org forums... there may be someone in there who has gone through this process themselves recently, and may be able to help you.
hi ... how can i get this code otomatic
ReplyDelete@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
}
i know if im using eclipse it's otomatic generate if im call that's function. how even in processing ?.
should i copy paste or write manual ?
In processing - you will need to copy and paste or write it manually. (Or a combination of both).
DeleteThanks a lot Scott..... :)
ReplyDeleteI will just like to add few more things, while setting up processing and SDK , to remember to check that you have JDK installed [see if you can compile any Java program,using javac]. Because otherwise, the above given codes won't compile using processing.
Also remember while setting up SDK, not to install Android SDK Tool API:19 or higher, but instead use some lower API level. I don't know exactly why this creates a problem, but it does and by downgrading the API level things started working for me[ It may look silly , but that's what happened].
Thanks Ankit,
DeleteWhen I wrote this - only API 10 was supported by the Processing IDE.
Not sure if this has changed to anything higher. But if in doubt, follow the instructions as provided. Thanks for highlighting these points Ankit - much appreciated
Scott
how can i find which API is supported by processing at present
ReplyDeleteFor the latest and most up to date version, please follow the instructions on this website: http://wiki.processing.org/w/Android
DeleteAlso look at
Deletehttp://processing.org/tutorials/android/
and
http://blog.blprnt.com/blog/blprnt/processing-android-mobile-app-development-made-very-easy
HI Scott, I tried to change the mode from Java to Android in Processing but the title bar didnt change to green color. What is the problem with that? Many thanks! Really appreciate your efforts.
ReplyDeleteProcessing has changed since I wrote this tutorial. Have not tried it since.
DeleteBut if you can see that the setting says Android as opposed to JAVA, you should be ok.
Hi Scott,
ReplyDeleteI've selected Android in Processing and it asked me to restart Processing. When i restarted, a dialogue box is appearing saying "Is Android SDK installed?" But i've already installed the SDK. When I'm manually giving the path of the SDK to processing its saying file not found. Please help
Some of the comments above May help you. Otherwise the processing forums will be your best bet. I will try and go through the whole process again soon and update this tutorial accordingly, but that will not happen for at least another month or so.
DeleteGreat site, Thank you.
ReplyDeleteHere is the problem I met and the resolve method
http://doublexia.wordpress.com/2013/12/03/processing-2-1-getting-error-running-javac-exe-compiler-message-in-android-mode/
http://stackoverflow.com/questions/12702608/processing-stuck-at-waiting-for-device-while-trying-to-connect-to-emulator
Hi Scott,
ReplyDeleteLike everyone else i appreciate your tutorials allot especially the 433MHz RF module tutorial, at the moment i'm trying to do this tutorial but i'm getting some trouble at sketch number 4.
The sketch runs fine when my devices bluetooth is turned off before i upload the sketch. Then after the app asks me permission to turn on bluetooth i press OK and then it just gives me a White screen unable to do anything further. It doesn't show me the discovered bluetooth devices its just a white screen.
The other scenario i have is when my bluetooth on my device is already enabled before i upload the sketch, then the app/program just jumps straight to the white screen. So if you or someone maybe have an idea on whats going wrong or methods on debugging or modifying the sketch i would appreciate a reply.
I have already commented out a few different bits of the code but it didn't change the outcome.
Later on I realize it had something to do with my phones bluetooth being enable beforehand, tho the sketch only crashes after the bluetooth is enabled.
My device is a Samsung S4 running android version 4.4.2.
Again much much Thanks for this awesome site and tutorials keep it up.
Hi Cm,
DeleteThank you for the feedback -
You can probably tell that this tutorial is a bit dated by the phone that I used.
I have not checked to to see if this tutorial is still current using the most recent Arduino /Processing IDEs... so take that into consideration.
Also - in this tutorial , you will see me talking about the use of LogCat.
I used this a lot when I first started to figure out Bluetooth. It helps to point out where your program is crashing.
I probably should go back one day and see if I can update these tutorials... but time is always a factor for me...
Good luck.
If you are looking for an app to communicate via Bluetooth - worth having a look at this site http://coretechrobotics.blogspot.com.au/2014/08/a-universal-bluetooth-remote-app.html
ReplyDeleteI have not tested it myself - but it looks interesting nonetheless.
This android app fails a lot for me on the bluetooth connect. Every once in awhile it does connect though and works very well. I was looking into what the problem might be and figure it is likely because bluetooth discovery isn't cancelled before the app connects to the device.
ReplyDeleteHow would one go about doing this in the program?
Thanks!
Ok, well I found how to do this and I'm able to connect with much more reliability with the following change to the code in connect2Bt().
Deletevoid connect2Bt() {
btAdapter.cancelDiscovery(); // Cancel discovery for connection reliability
try {
btSocket = btShield.createRfcommSocketToServiceRecord(uuid);
Now I just need to find a way to release the adapter when the program exits so that it doesn't lock up the BT adapter until it times out.
DeleteHI; Mr Scott C
ReplyDeleteCopy the code in processing but not running gives several errors is probably because I not have installed some library required
Consultation for Mr Scott C
where could download these libraries such as android.bluetooth.BluetoothAdapter
gracias por tu ayuda
carlos
Make sure that you are in the android section of the processing IDE.
DeleteThe import statement should work if you followed my instructions above. However, this tutorial is getting pretty old now, and it is possible that it is no longer compatible with current versions of software. If possible, try to use the software versions that I used.
At some point I will have to come back and re-visit this tutorial and update it (if necessary)
Hiho.
ReplyDeleteI experienced some issues using the Android mode in the Processing IDE. The Android mode did not show up when I clicked the Mode button. After some investigation I found out that the newest stable version of Processing IDE (2.2.1) is not working with modes correctly. I had to install the Pre-Release 3.0A5 version instead of the Stable 2.2.1. Hope this can be of help to people trying to get this thing to work.
Btw. You don't need to download the Android mode from the Processing/Android github anymore. Nowdays it's built into the processing IDE (but not working in 2.2.1) so you just select it from the Mode tab.
Hi scott.
ReplyDeleteI am having an error on onActivityResult
also startActivityForResult function does not exist. Am i missing any libraries?
Make sure to enable Bluetooth... The tutorial should work as described above, however, this tutorial was made ages ago - and therefore versions of IDE and SDK may no longer exist..
DeleteYou may want to have a look at this site:
https://github.com/processing/processing-android/wiki
Scott, Will i have problems when I run this on API 22 or API 23? I cannot seem to select the API 10 on my Processing IDE even tho I have downloaded the package from SDK manager
ReplyDeleteI am sorry Kyle - I am not sure - I have not tested it.
DeleteI might have to remove this tutorial if it is no longer possible to get it to work.
Hey Scott ,you are right this tutorial no longer work ,i have same problem as Kyle,
ReplyDeleteif(resultCode == RESULT_OK)
^^^^^^^^^
RESULT_OK cannot be resolved to a variable
and i could work with API 10 either ,is there any chances you could update this tutorial?
I would love to revisit this, but I can honestly say that it will not happen for at least 6 months or longer.
DeleteHey Scott, thanks for the tutorial. I've got it working in Processing 3. The changes needed are:
ReplyDelete1) change "protected void onActivityResult(...)" to "public void onActivityResult(...)".
2) change "RESULT_OK" for "Activity.RESULT_OK" and import android.app.Activity (or you could change it to -1 which I believe is the value for this constant).
I think that's it. The highlighter will show errors on onActivityResult() and on startActivityForResult() but the code will compile and run properly.
Thanks Felipe - I am sure many will benefit from this information.
DeleteThank you very much.
Thank you! It is finally working!
Deletethis is what worked for me.......processing 3.3.3/API6.0(23)/sonyF3111
Delete1) do as Felipe says change "protected void" to "public void"
2) change "RESULT_OK" to "getActivity.RESULT_OK" -
i had mixed results with this on different configurations - it worked but still showed errors in that case DON'T do anything in 2, try:
3) add "import static android.app.Activity.RESULT_OK;" at the top of the sketch.
Big thank you to Scott C and Felipe here, great tutorial Scott - just hope you could update your post
more hits == more sponsors
Hi gest1t,
DeleteI appreciate your feedback, and value your input.
Thank you for your comments.
I no longer have an android device to test it out on, so wouldn't be able to update it even if I tried. But you never know, maybe one day.
Same as Scott C.
ReplyDeleteThank you.
Hello, Scott. Thank you so much for this tutorial it is everything I needed to know. I am experiencing a problem after I try to upload the first simple sketch on my Android (Lenovo A328). Everything seems to be fine on Processing end but when the phone launches the sketch it is just white screen. It is like the actual image is not generating at all. Any ideas?
ReplyDeleteHi, I am using micromax a310 device i have used all the 3 code but the problem is it shows white screen on the micromax a310 screen
ReplyDeletesecond problem is that the green symbol is not displayed in processing utility. i have used api19 version 4.4.2
First Example is working fine ... No problem .. Second example gives following error ..
ReplyDeleteAPButton cannot be resolved to a type
----------
18. ERROR in C:\Users\ADMIN\AppData\Local\Temp\android7030721473606456066sketch\src\processing\test\bluetoothbuttons\BluetoothButtons.java (at line 44)
widgetContainer.addWidget(blueButton);//place blue button in container
^^^^^^^^^^^^^^^
APWidgetContainer cannot be resolved to a type
----------
19. ERROR in C:\Users\ADMIN\AppData\Local\Temp\android7030721473606456066sketch\src\processing\test\bluetoothbuttons\BluetoothButtons.java (at line 44)
widgetContainer.addWidget(blueButton);//place blue button in container
^^^^^^^^^^
APButton cannot be resolved to a type
----------
20. ERROR in C:\Users\ADMIN\AppData\Local\Temp\android7030721473606456066sketch\src\processing\test\bluetoothbuttons\BluetoothButtons.java (at line 45)
widgetContainer.addWidget(offButton);//place off button in container
^^^^^^^^^^^^^^^
The examples work if you follow them exactly - but my guess is that you are using a different version of Processing/Android to the one I used. I am not exactly sure which sketch you are referring to.
Delete